题意:一年有\(n\)个月,每月有\(d_{i}\)天,找出连续的\(x\)天,使得这\(x\)天的日期总和最大,任意一年都能选. 题解:首先要先贪心,得到:连续的\(x\)天的最后一天一定是某个月的最后一天,我们先预处理两个前缀和,分别记录连续的天数和总日期数,然后枚举,二分找出一个区间,得出这个区间的总日期数再加上区间最左边的剩余的\(x\)的总日期,每次维护一个最大值即可.(记得开\(long\ long\)) 代码: #include <iostream> #include <c…
C. GukiZ hates Boxes Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/551/problem/C Description Professor GukiZ is concerned about making his way to school, because massive piles of boxes are blocking his way. In total there…
Codeforces Round #297 (Div. 2)C. Ilya and Sticks Time Limit: 2 Sec  Memory Limit: 256 MBSubmit: xxx  Solved: 2xx 题目连接 http://codeforces.com/contest/525/problem/C Description In the evening, after the contest Ilya was bored, and he really felt like ma…
A.Accurate Movement(复现赛) 题意:两个木块最左边都在0的位置,最右边分别为a,b(b>a),并且短的木条只能在长木条内移动,问两个木条需要移动多少次才能使两个木条的右端都在n 思路:短木条最少移动(n-a)/(b-a),如果(n-a)%(b-a)不为0,那么还需要再多移动一次,才能到达最右边,长木条以此类推 代码: 1 #include<iostream> 2 #include<algorithm> 3 #include<cmath> 4 #…
题目链接:The Best Vacation 题意: 给你n个月份,每一个月份有di天.你可以呆在那里x天(x天要连续),如果你在某月的第y天呆在这.那么你的拥抱值就加y 1<=n<=2e5 1<=di<=1e6 题解: 首先这段日期的结尾一定是月末.下面证明 如果x<=max(d1,d2...dn) 那么肯定是在那个max(d1,d2...dn)那个月最后x天呆在那得到的拥抱值最大 如果选取的这段日期至少覆盖到两个月份.如果右端点不是月末的话,假设左端点对应的日期大于右端点…
题目链接:C.Celex Update 题意: 给你如图所示的图形,问从(x1,y1)−>(x2,y2)路径上的不同的元素和的数量是多少. 题解: 从(1,1)到(3,3) 元素和的1−2−4−8−13是这些元素和中最小的一个,然后1−2−5−8−13和之前的一个相比多了1,在2处增加一个的话,那么就是1−3−5−8−13这就是增加了两个的了,最后我们可以发现从最小的元素和到最大的元素中全部的都会出现,那么就是计算中间的差值 这几个块,每多用一个,就比之前的多加1 代码: #include<s…
B. Anton and Lines   The teacher gave Anton a large geometry homework, but he didn't do it (as usual) as he participated in a regular round on Codeforces. In the task he was given a set of n lines defined by the equations y = ki·x + bi. It was necess…
地址:http://codeforces.com/problemset/problem/712/C 题目: C. Memory and De-Evolution time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Memory is now interested in the de-evolution of objects, sp…
题目链接:http://codeforces.com/problemset/problem/731/C 题意:有n只袜子,每只都有一个颜色,现在他的妈妈要去出差m天,然后让他每天穿第 L 和第 R 只袜子,他为了让每天穿的袜子都是一个颜色的,他需要把袜子涂色,共有k种颜色,求最少需要涂多少只袜子,才能保证他每天穿的袜子都是一样的. 用并查集把所有联系在一起的袜子放到一个集合中去,然后这些袜子会变成一块一块的,我们在每一块中找一种颜色最多的,然后把当前块中的其他袜子都涂成这种颜色即可,累加即可 #…
A. Vitya in the Countryside time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Every summer Vitya comes to visit his grandmother in the countryside. This summer, he got a huge wart. Every gran…