—————贪心—————
tjx_belief
这个作者很懒,什么都没留下…
展开
-
HDU - 3177 Crixalis's Equipment
原题链接思路: 贪心法,希望每次选择的物品所占空间尽可能小而所需通道尽可能大。 可以先以判断有两个物品时的排序,则先放1物品时要求v-a1>=b2,则所需的v最少为a1+b2;先放2物品时要求v-a2>=b1,则所需的v最少为a2+b1。原创 2017-02-18 20:13:45 · 207 阅读 · 0 评论 -
POJ 3069 Saruman's Army
原题链接 Description Saruman the White must lead his army along a straight path from Isengard to Helm’s Deep. To keep track of his forces, Saruman distributes seeing stones, known as palantirs, among the原创 2017-02-21 20:08:10 · 179 阅读 · 0 评论 -
POJ 5253 Fence Repair
思路:倒着想,木块已经全部切割,每次选择最小的两块合并,直到合并为一块位置。原创 2017-02-21 21:15:39 · 145 阅读 · 0 评论 -
***POJ 3617 Best Cow Line【牛排队】
贪心法,字典序最小问题原创 2017-02-20 22:37:34 · 169 阅读 · 0 评论 -
POJ 2376 Cleaning Shifts
原题链接思路:贪心。AC代码:#include <iostream> #include <cstdio> #include <algorithm> #include <cstdlib> #include <cstring> #include <cmath> #include <utility> using namespace std; typedef pair<int,int> PII;int N原创 2017-03-15 23:59:28 · 155 阅读 · 0 评论 -
POJ 1328 Radar Installation
原题链接思路:贪心。第一个卫星的位置在s1和e1之间,若s2<=e1则不需要新卫星,第一个卫星位置更新为s2和e2之间;若s2>e1则需要新卫星,第二个卫星位置在s2和e2之间。以此类推。AC代码:#include <iostream> #include <cstdio> #include <algorithm> #include <cstdlib> #include <cstring> #inc原创 2017-03-16 23:22:04 · 168 阅读 · 0 评论