Codeforces 1072 C - Cram Time】的更多相关文章

C - Cram Time 思路:首先找到最大的x,使得x*(x+1)/2 <= a+b 那么一定存在一种分割使得 a1 <= a 且 b1 <= b 证明: 从x 到 1枚举过去,对于某个i 如果 a >= i, 那么这个i放在第一天 如果a < i,那么后面肯定会遇到一个a把第一天填满(因为我们是从大到小枚举的) 所以第一天可以填满,那么除了第一天剩下的加起来也小于等于b 证毕 代码: #pragma GCC optimize(2) #pragma GCC optimiz…
链接:http://codeforces.com/contest/1072/ A - Golden Plate - [计算题] #include<bits/stdc++.h> using namespace std; inline )*;} int w,h,k; int ans; int main() { cin>>w>>h>>k; ,h-=,k--) ans+=calc(w,h); cout<<ans<<endl; } B - Cu…
[链接] 我是链接,点我呀:) [题意] 题意 [题解] 如果找到最大的n使得1+2+...+n<=a+b 然后第一天输出1,2.3,4....t1 这里1+2+..+t1<=a 这还远远不够. 因为可能1+2+3...+t1<a 这就使得第一天还有剩余的时间没有用. 那么接下来如果继续让第二题从t1+1..n的话 可能第二题的累加和会大于b 所以我们可以这样, 让第二题再加上一天. 即输出1,2.3....t1,t1+1 然后从中删掉一个数字x=1+2+3..+t1+(t1+1)-a…
https://codeforces.com/contest/1065 题意 给你a,b,让你找尽量多的自然数,使得他们的和<=a,<=b,用在a和b的自然数不能重复 思路 假如只有一个数a让你去找,问题就很简单了,就是找到一个x,使得x尽量大,且x*(x+1)/2<=a,意味着答案就是1~x 我的思路是从1开始累加,加到一个不能再加的数时,向后退一个数,加上n-sum(1~a[i-1])(ps:a[i+1]为不能再加的数) 错误贪心思想:假如加到不能再加,同样是只能再加一个数了,不如把…
http://codeforces.com/contest/1072/problem/C C. Cram Time time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output In a galaxy far, far away Lesha the student has just got to know that he has an exa…
CF-1072-C. Cram Time http://codeforces.com/contest/1072/problem/C 题意: 第一天有 a 小时,第二天有 b 小时.第 k 个任务需要 k 个小时来完成.任务不能隔天做(即第一天开始,第二天结束).问这两天分别可以最多完成多少任务,并输出. 分析: 既然总共有a+b个小时,那么每个任务所需时间越少,任务数越多.即我们要找到一个最大的k有\(k*(k+1)/2 \le (a+b)\) 即前k个任务的所需时间和小于等于a+b 找到k之后…
http://codeforces.com/contest/1072/problem/D bfs 走1步的最佳状态 -> 走2步的最佳状态 -> …… #include <bits/stdc++.h> using namespace std; #define ll long long #define minv 1e-6 #define inf 1e9 #define pi 3.1415926536 #define nl 2.7182818284 ; ; struct node {…
Adieu l'ami. Koyomi is helping Oshino, an acquaintance of his, to take care of an open space around the abandoned Eikou Cram School building, Oshino's makeshift residence. The space is represented by a rectangular grid of n × m cells, arranged into n…
https://codeforces.com/contest/1072/problem/D 题意 给你一个n*n充满小写字母的矩阵,你可以更改任意k个格子的字符,然后输出字典序最小的从[1,1]到[n,n]的路径(1<=n<=2000) 思路 我的 定义dp[i][j]为从[1,1]到[i,j]字符串最小的字符串,然后枚举所有i-1+j-1+1<=k的点,然后字符串连接比较,代表更改前面i,j个字符 这种思路有两个问题,如何处理出从[i,j]到[n,n]的最小字典序字符串,第二假如i+j…
Codeforces Round #517 (Div. 2, based on Technocup 2019 Elimination Round 2) #include <bits/stdc++.h> using namespace std; int n,m,k; ; int main() { cin>>n>>m>>k; ;i<=k-;++i) { sum+=(n+(m-))*-(i)*; } cout<<sum<<endl;…