Codeforces
文章平均质量分 81
hxer
这个作者很懒,什么都没留下…
展开
-
Codeforces 612E - Square Root of Permutation
E. Square Root of PermutationA permutation of length n is an array containing each integer from 1 to n exactly once. For example, q = [4, 5, 1, 2, 3] is a permutation. For the permutation q the square原创 2016-01-21 17:07:23 · 517 阅读 · 0 评论 -
Codeforces 616E - Sum of Remainders
616E Sum of Remainders题目:Calculate the value of the sum: n mod 1 + n mod 2 + n mod 3 + … + n mod m. As the result can be very large, you should print the value modulo 109 + 7 (the remainder when divide原创 2016-01-21 10:47:31 · 624 阅读 · 0 评论 -
Educational Codeforces Round 6 C. Pearls in a Row
Educational Codeforces Round 6 C. Pearls in a Row题意:一个3e5范围的序列;要你分成最多数量的子序列,其中子序列必须是只有两个数相同, 其余的数只能出现一次。策略: 延伸:这里指的延伸如当发现1…1如果以最后出现重叠的数为右边界则就表示左延伸,若以1.0.1..0第二个0前一个位置作为右边界就为右延伸; 开始时想是右延伸,考虑到可能只出现一组两原创 2016-01-22 15:10:19 · 313 阅读 · 0 评论 -
Codeforces Round #336 (Div. 2) D. Zuma
Codeforces Round #336 (Div. 2) D. Zuma题意:输入一个字符串;每次消去一个回文串,问最少消去的次数为多少?思路:一般对于可以从中间操作的,一般看成是从头开始(因为只需要考虑一边),当考虑最左边的数时,有多少中消去方法?每种消去方法对结果的贡献又是多少?同时结果的区间又是怎么变化?这就是dp式子;1.当单独消去这个元素时,dp[l][r] = 1 + dp[l原创 2016-01-23 17:10:11 · 324 阅读 · 0 评论 -
Codeforces Problem 598E - Chocolate Bar
Educational Codeforces Round 1 E. Chocolate Bar题意: 有一个n*m(1<= n,m<=30)的矩形巧克力,每次能横向或者是纵向切,且每次切的花费为所切边长的平方,问你最后得到k个单位巧克力( k <= min(n*m,50) )的最小花费是多少?思路: 数据规模不大,但是贪心不能得到最优解,很自然想到了dp;里面涉及到行的减少和列的减少,在dp原创 2016-01-24 11:54:15 · 162 阅读 · 0 评论 -
Codeforces Round #336 (Div. 1) A - Chain Reaction
336 (Div. 1) A. Chain Reaction题意:有n(1 ≤ n ≤ 100 000) 个灯泡,每个灯泡有一个位置a以及向左照亮的范围b (0 <= a <= 1e6 ,1<= b <= 1e6);(题目是按照灯泡位置递增的顺序输入的)每个灯泡的毁坏范围就是灯泡的照亮范围(包括左边界,但是自己不会毁坏)。要你在所有灯泡的右边(不能有灯泡的位置相同)任意位置设置一个向左照亮范围任原创 2016-01-24 20:14:21 · 389 阅读 · 0 评论 -
Educational Codeforces Round 6 D. Professor GukiZ and Two Arrays
Educational Codeforces Round 6 D. Professor GukiZ and Two Arrays题意:两个长度在2000的-1e9~1e9的两个序列a,b(无序);要你最多两次交换元素,使得交换元素后两序列和的差值的绝对值最小;输出这个最小的和的差值的绝对值;并且输出交换次数和交换的序号(从1 开始) Input 5 5 4 3 2 1 4 1 1 1原创 2016-01-26 19:57:31 · 524 阅读 · 0 评论 -
Good Bye 2015 D. New Year and Ancient Prophecy
Good Bye 2015 D. New Year and Ancient Prophecy题意:给一个长度为n(1<= n <= 5000)的只含有数字的字符串,字符串首位不为’0’;将字符串分割成数值严格递增的子串;并且每一个子串不能以0开头;这样的分割方式有多少种?思路:分割,显然要将每种情况都探究到,DP的特点。其中需要优化的点有 怎么快速比较两个子串表示的数值的大小? LCP(原创 2016-01-26 20:23:01 · 407 阅读 · 0 评论