Delicious Apples Time Limit: 5000/3000 MS (Java/Others)    Memory Limit: 524288/524288 K (Java/Others) Total Submission(s): 199    Accepted Submission(s): 54 Problem Description There are n apple trees planted along a cyclic road, which is L metres l…
题目链接: HDU5303 题意: 有一条环形的长为L的路,仓库在位置0处, 这条路上有n棵苹果树,给出每棵苹果树的位置和苹果数量, 问用 一次最多能装K个苹果的篮子   把这条路上全部苹果採回仓库最少须要走的距离 解题思路: 这条路是环形的,先把果树分为两部分,圆的左半边算一部分,圆的右半边算还有一部分 对全部苹果依据距离排序 , 用类似背包的思想,  统计左半边,右半边用 来回走(来回的长度一定小于一个圆环的周长)的方式採集完苹果所须要走的最少距离; 最后 考虑须要走一圈的情况:左边 多出k…
Sample Input 4 8 4 1 3 2 2 1 0 3 5 3 6 4 2 1 7 6 8 3 3 2 0 5 0 3 6 4 5 2 7 7 6 7 6 8 2 2 3 3 3 0 0 2 7 4 3 6 3 2 2 5 8 5 6 5 3 3 1 2 4 6 7 7 6 5 4 3 5   Sample Output 7 1 7 6 5 2 4 3 8 8 4 6 3 1 2 5 8 7 7 3 6 7 1 5 2 8 4 0 1 2 3 4 5 6 7 8 找出能约出最多人的顺序…
First One Time Limit: 4000/2000 MS (Java/Others)    Memory Limit: 131072/131072 K (Java/Others) Total Submission(s): 142    Accepted Submission(s): 37 Problem Description soda has an integer array a1,a2,-,an. Let S(i,j) be the sum of ai,ai+1,-,aj. No…
Sample Input 1 10 2 3 4 4 3 2 2 3 4 4   Sample Output Case #1: 9 要求找出一段数字. 将其分成3部分,第①和第②部分成回文字串,第②和第③部分成回文字串 用manacher算出各个点的回文后字串长度,然点枚举和半径(后部分稍不注意就超时  - -!!) #include <cstdio> #include <iostream> #include <algorithm> #define MAXN 100010…
Delicious Apples Time Limit: 5000/3000 MS (Java/Others)    Memory Limit: 524288/524288 K (Java/Others) Total Submission(s): 587    Accepted Submission(s): 188 Problem Description There are n apple trees planted along a cyclic road, which is L metres…
Delicious Apples Time Limit: 5000/3000 MS (Java/Others)    Memory Limit: 524288/524288 K (Java/Others) Total Submission(s): 321    Accepted Submission(s): 95 Problem Description There are  apple trees planted along a cyclic road, which is  metres lon…
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=5303 题意:在一个长为L的环形路径上种着一些苹果树,告诉你苹果树的位置(题目中以0~L指示坐标)及苹果树上的苹果数,现在你要采集所有的苹果(大概是你有一个容量为K的筐,你采集的苹果要装在筐里,采集完要回到坐标0的家里清空筐),问你最少需要走多少路 解:可以想象最多需要走一次整环,剩下的是走两个半环,那么分别对两个半环贪心(由于数据量较小,有很优雅的姿势~) 然后考虑走的这一次整环,由于这次整环的花费…
Delicious Apples Time Limit: 5000/3000 MS (Java/Others)    Memory Limit: 524288/524288 K (Java/Others) Total Submission(s): 1371    Accepted Submission(s): 448 Problem Description There are n apple trees planted along a cyclic road, which is L metres…
Delicious Apples Time Limit: 5000/3000 MS (Java/Others)    Memory Limit: 524288/524288 K (Java/Others) Total Submission(s): 395    Accepted Submission(s): 122 Problem Description There are n apple trees planted along a cyclic road, which is L metres…