Innokentiy likes tea very much and today he wants to drink exactly n cups of tea. He would be happy to drink more but he had exactly n tea bags, a of them are green and b are black. Innokentiy doesn't like to drink the same tea (green or black) more than k times in a row....
Innokentiy likes tea very much and today he wants to drink exactly n cups of tea. He would be happy to drink more but he had exactly n tea bags, a of them are green and b are black. Innokentiy doesn’t like to drink the same tea (green or black) more than k times in a row....
Codeforces 746D:Green and Black Tea(乱搞) http://codeforces.com/contest/746/problem/D 题意:有n杯茶,a杯绿茶,b杯红茶,问怎么摆放才可以让不超过k杯茶连续摆放,如果不能就输出NO。 思路:首先,设x = min(a,b),y = max(a,b),然后如果(y + x)/(x + 1) > k,那么就输出NO。即把 y 平均分...
CodeForces 746D Green and Black Tea 有坑 题意很明显不解释 做法就是直接模拟 有一个坑的地方就是中间值会爆ll WA50 1#include<bits/stdc++.h>2#definecl(a,b) memset(a,b,sizeof(a))3#definedebug(a) cerr<<#a<<"=="<<a<<endl4usingnamespacestd;5typedeflonglongll;6typedef pair<int,int...
D. Green and Black Tea 贪心 + 构造 http://codeforces.com/contest/746/problem/D 首先说下一定是NO的情况。 假设a > b 那么,b最多能把a分成b + 1分,如果每份刚好是k的话,那么就最多能支持a的最大值是(b + 1) * k 其实就好比如,分成3分的话,x1 + x2 + x3 = m,每个xi <= k的,那么...