
二分贪心
菜圾
Hi, it's your Accepted !
展开
-
U - 21
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. "N原创 2017-04-19 23:57:08 · 214 阅读 · 0 评论 -
Codeforces - Gym - 101778B - Ran and the Lock Code - (二分)
题目链接:http://codeforces.com/gym/101778/problem/BCodeforces上的一篇题解:http://codeforces.com/blog/entry/58982题意:给出n和a,让找一个n个数的正整数集合使得这个集合中的元素累加和的平均值等于a,基于此求满足此条件的集合中互不相同的元素的个数最多是多少。解析:1.找集合a1,a2...an,且他们的和等于...原创 2018-05-13 22:14:15 · 361 阅读 · 0 评论 -
Cow Acrobats
Farmer John's N (1 <= N <= 50,000) cows (numbered 1..N) are planning to run away and join the circus. Their hoofed feet prevent them from tightrope walking and swinging from the trapeze (and their las原创 2017-08-17 19:14:41 · 312 阅读 · 0 评论 -
poj-2376--Cleaning Shifts--(贪心)
Farmer John is assigning some of his N (1 <= N <= 25,000) cows to do some cleaning chores around the barn. He always wants to have one cow working on cleaning things up and has divided the day into T原创 2017-08-16 15:28:30 · 212 阅读 · 0 评论 -
E - 05
Farmer John has built a new long barn, with N (2 <= N <= 100,000) stalls. The stalls are located along a straight line at positions x1,...,xN (0 <= xi <= 1,000,000,000). His C (2 <= C <= N) cows don't like this barn layout and become aggressive towards e原创 2017-04-23 19:21:11 · 302 阅读 · 0 评论 -
D - 04
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-04-26 20:39:01 · 212 阅读 · 0 评论 -
A - 01
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-04-26 18:57:17 · 228 阅读 · 0 评论 -
X - 24
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 19:26:36 · 281 阅读 · 0 评论 -
T - 20
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-23 17:57:55 · 221 阅读 · 0 评论 -
2015 Multi-University Training Contest 2 - Delicious Apples - (贪心)
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=5303题意:长为L的环上有n个苹果树,环上0坐标在最上方,顺时针为坐标增加方向,给出每个苹果树的位置和数上的苹果数量,有容量为k的篮子,求摘完所有苹果的最小路程。解析:摘苹果路线有3种情况:1、左边去摘,然后按原路返回 ;2、右边去摘,然后按原路返回;3、直接走一圈;直接走一圈的情况自适用于...原创 2018-07-18 21:29:11 · 165 阅读 · 0 评论