B. New Year and North Pole time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output In this problem we assume the Earth to be a completely round ball and its surface a perfect sphere. The length of…
A. New Year and Hurry time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Limak is going to participate in a contest on the last day of the 2016. The contest will start at 20:00 and will last f…
A. New Year and Days 题目连接: http://www.codeforces.com/contest/611/problem/A Description Today is Wednesday, the third day of the week. What's more interesting is that tomorrow is the last day of the year 2015. Limak is a little polar bear. He enjoyed…
A. New Year and Hurry time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Limak is going to participate in a contest on the last day of the 2016. The contest will start at 20:00 and will last f…
codeforces Good bye 2016 E 线段树维护dp区间合并 题目大意:给你一个字符串,范围为‘0’~'9',定义一个ugly的串,即串中的子串不能有2016,但是一定要有2017,问,最少删除多少个字符,使得串中符合ugly串? 思路:定义dp(i, j),其中i=5,j=5,因为只需要删除2016当中其中一个即可,所以一共所需要删除的字符和需要的字符为20176,因此i和j只要5就够了. 然后转移就是dp(i,i) = 0, 如果说区间大小为1的话,那么如果是2017中的一个…
传送门 题意: 给出一个长度为\(n\)的串,现在有\(q\)个询问,每个询问是一个区间\([l,r]\),要回答在区间\([l,r]\)中,最少需要删多少个数,满足区间中包含\(2017\)的子序列而不包含\(2016\)的子序列. 思路: 先不考虑多个询问,那么这个问题区间\(dp\)可以解决,状态定义中要附加状态转移的代价. 比如当前数字为\(7\),那么显然从状态\(201\)转移过来需要\(0\)的花费:但如果不要\(7\),那么从状态\(201\)到状态\(201\)则需要\(1\)…
A - New Year and Hurry (water) #include <bits/stdc++.h> using namespace std; int main() { ]; ; i <= ; i++) { a[i] = ( + i) * i / * ; } int n ,k; while(~scanf("%d%d", &n, &k)) { ; ; i <= n; i++) { - k >= a[i]) ans = i; } pr…
题目链接:http://codeforces.com/contest/750/problem/D 题意:新年烟花爆炸后会往两端45°差分裂.分裂完后变成2部分,之后这2部分继续按这种规则分裂.现在给你每一步分裂的个数.有可能几个部分都是分裂到一个位置,这种情况只算一个.问最后分裂完有多少个. 思路:模拟即可.由于n最多30,每次最多分裂5个.所以总体规模不是很大.但是需要记忆化一下防止TLE.G[][]表示被覆盖的格子.vis[k][i][j][d]表示第k次分裂在位置(i,j)方向为d时是否出…
题目链接:http://codeforces.com/contest/750/problem/C 题意:在CF中,每个人都有个Rank值. 当Rank>=1900时,为DIV1.Rank<1900时,为DIV2.现在给你参加每一场的DIV值和参加完这一层后的Rank值变化.问最大可能的初始Rank值.如果答案无限大输出Infinity,如果不可能出现输入的情况输出impossible.其他情况输出可能的最大答案. 思路:二分初始Rank值,然后在二分出来的初始Rank值在计算过程中发现分值在D…
题目链接:http://codeforces.com/contest/750/problem/B 题意:地球的子午线长度为40000,两极点的距离为20000.现在你从北极出发,按照题目输入方式来走.有规定在北极时只能往南方向走,同理在南极.最后走完后要回到北极.问输入的路线是否合法. 思路:按照题意模拟就好了.定义Point为离北极的距离,初始Point为0,因为起点在北极. 当这次行动为w/e时如果Point为0/20000(在极点)时路线不合法. 当这次行动为n时,如果Point为2000…