![](https://img-blog.csdnimg.cn/20201014180756738.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
二分贪心练习
文章平均质量分 74
胖亚亚
这个作者很懒,什么都没留下…
展开
-
D
DescriptionThe SUM problem can be formulated as follows: given four lists A, B, C, D of integer values, compute how many quadruplet (a, b, c, d ) ∈ A x B x C x D are such that a + b + c + d = 0原创 2017-05-01 20:58:59 · 247 阅读 · 0 评论 -
codeforces 807 E. Prairie Partition(贪心+思维)
题意:已知每个数都能用x=1 + 2 + 4 + ... + 2k - 1 + r (k ≥ 0,0 < r ≤ 2k)来表示,给出一串数字问这串数字能有几个x表示。输出可能的长度。思路:https://www.cnblogs.com/TnT2333333/p/6828340.html?utm_source=itdadao&utm_medium=referral...原创 2019-05-26 10:48:38 · 376 阅读 · 0 评论 -
Codeforces 807C - Success Rate(二分枚举)
题意:给你T组数据,每组有x,y,p,q四个数,x/y是你当前提交正确率,让你求出最少需要再提交几次可以达到目标正确率p/q;思路:假设提交B次,正确A次,那么可以得到(x+A)/(y+B)=p/q,可以推出x+A=k*p,y+B=k*q.那么A=k*p-x,B=K*q-y;这样我们只需要二分枚举k,判断A,B是否满足(0<=A<=B)即可。代码:#inclu...原创 2019-05-26 10:40:30 · 362 阅读 · 0 评论 -
EOJ Monthly 2018.2 (Good bye 2017)A1. 坑爹的售票机 (Easy)
oxx 和 xjj 决定和小伙伴们一同坐船前往 Xiamen。去 Xiamen 的船票一张 p 元。当他们满怀兴致地来到港口时发现居然只有不设找零的自动售票机,只能使用一元,五元,十元,二十元,五十元,一百元的纸币,且一次至多买 k 张船票。因此他们不得不去银行取钱。而 oxx 是个大懒人,他希望取的纸币数量越少越好,因此他想知道他们一行 n 人要都买到票至少需要取多少张纸币。Input第一行三个...原创 2018-02-14 16:17:53 · 683 阅读 · 0 评论 -
X
DescriptionThe whole family was excited by the news. Everyone knew grandpa had been an extremely good bridge player for decades, but when it was announced he would be in the Guinness Book of Wor原创 2017-04-25 21:35:16 · 234 阅读 · 0 评论 -
T
DescriptionA factory produces products packed in square packets of the same height h and of the sizes 1*1, 2*2, 3*3, 4*4, 5*5, 6*6. These products are always delivered to customers in the square原创 2017-04-25 21:14:14 · 210 阅读 · 0 评论 -
E
DescriptionFarmer John has built a new long barn, with N (2 His C (2 <= C <= N) cows don't like this barn layout and become aggressive towards each other once put into a stall. To prevent th原创 2017-04-24 23:13:16 · 190 阅读 · 0 评论 -
U-Box of Bricks
DescriptionLittle Bob likes playing with his box of bricks. He puts the bricks one upon another and builds stacks of different height. "Look, I've built a wall!", he tells his older sister Alice原创 2017-04-24 18:20:43 · 256 阅读 · 0 评论 -
B
DescriptionYou have just moved from Waterloo to a big city. The people here speak an incomprehensible dialect of a foreign language. Fortunately, you have a dictionary to help you understand the原创 2017-04-22 22:58:53 · 227 阅读 · 0 评论 -
S
DescriptionMany graduate students of Peking University are living in Wanliu Campus, which is 4.5 kilometers from the main campus – Yanyuan. Students in Wanliu have to either take a bus or ride a原创 2017-05-01 23:23:51 · 261 阅读 · 0 评论 -
R
DescriptionAssume the coasting is an infinite straight line. Land is in one side of coasting, sea in the other. Each small island is a point locating in the sea side. And any radar installation,原创 2017-05-01 23:10:15 · 248 阅读 · 0 评论 -
V
DescriptionAn integer interval [a,b], a Write a program that: finds the minimal number of elements in a set containing at least two different integers from each interval.InputT原创 2017-05-01 22:37:55 · 231 阅读 · 0 评论 -
Q(这个题提交失败,但样例是对的QAQ,好像服务器有问题,不能提交)
DescriptionKarafs is some kind of vegetable in shape of an 1 × h rectangle. Tavaspolis people love Karafs and they use Karafs in almost any kind of food. Tavas, himself, is crazy about Karafs.原创 2017-05-01 22:02:50 · 535 阅读 · 0 评论 -
A
DescriptionA square is a 4-sided polygon whose sides have equal length and adjacent sides form 90-degree angles. It is also a polygon such that rotating about its centre by 90 degrees gives the原创 2017-05-01 21:46:05 · 206 阅读 · 0 评论 -
H
DescriptionGiven a N × N matrix A, whose element in the i-th row and j-th column Aij is an number that equals i2 + 100000 × i + j2 - 100000 × j + i × j, you are to find the M-th smallest eleme原创 2017-05-01 21:33:42 · 241 阅读 · 0 评论 -
G
DescriptionWhen a thin rod of length L is heated n degrees, it expands to a new length L'=(1+n*C)*L, where C is the coefficient of heat expansion. When a thin rod is mounted on two solid walls原创 2017-05-01 21:22:56 · 205 阅读 · 0 评论 -
F
DescriptionInhabitants of the Wonderland have decided to hold a regional programming contest. The Judging Committee has volunteered and has promised to organize the most honest contest ever. It原创 2017-05-01 21:17:52 · 179 阅读 · 0 评论 -
CodeForces - 805E - Ice cream coloring dfs+贪心
题意:有一棵具有 n 个节点的树,每个节点代表一个集合,表示集合内两两元素的颜色不同,同时保证集合中拥有某个元素的所有的节点附带着边提取出来,能够形成一个连通图,即不可能出现有三个节点 v1,v2,v3 , v1 与 v2 有树边, v2 和 v3 有树边,而 v1,v3 集合中有元素 x 而 v2 集合中没有。思路: dfs 遍历一遍整棵树,在遍历的过程染色。由于单一元素所处的集合都相邻...原创 2019-05-26 10:54:24 · 357 阅读 · 0 评论