贪心
文章平均质量分 68
Jane-Young
这个作者很懒,什么都没留下…
展开
-
poj 3553 Task schedule
贪心,按dj从小到大排序,并按次顺序加工。 因为对于最小的那个dj是不变的,那么如果先加工其他的,那么cj就会增大,从而cj - dj就会增大,所以要先加工dj小的。 #include #include #include #include #include using namespace std; vectorint>a[50005]; struct thing{ i原创 2013-11-15 10:19:20 · 1016 阅读 · 0 评论 -
hdu 1051 Wooden Sticks
Description There is a pile of n wooden sticks. The length and weight of each stick are known in advance. The sticks are to be processed by a woodworking machine in one by one fashion. It needs some原创 2013-11-15 10:18:10 · 694 阅读 · 0 评论 -
ZOJ 1307 Packets
Description A 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原创 2013-11-15 10:18:12 · 766 阅读 · 0 评论 -
hdu 4923 Room and Moor
输入由1和0组成的A序列,求一个长度与A序列相同的、在实数[0,1]之间的不下降序列B,使得sum of (Ai-Bi)^2最小,输出这个最小的sum。 首先可以先把A开头的0原创 2014-08-08 16:22:54 · 587 阅读 · 0 评论