贪心
leolin_
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
hdu 1051 Wooden Sticks 贪心
Wooden Sticks<br />Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)<br />Total Submission(s): 3559 Accepted Submission(s): 1442<br /><br />Problem DescriptionThere is a pile of n wooden sticks. The length and weight of原创 2011-04-29 19:46:00 · 716 阅读 · 0 评论 -
ZOJ 3508 The War 贪心
<br />贪心<br />http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemId=4351<br />对b从小到大排序就可以了<br />#pragma warning(disable :4786)#include<iostream>using namespace std;#include<algorithm>#include<set>struct node{ int a,b;}arm[2510];boo原创 2011-05-02 00:33:00 · 768 阅读 · 0 评论 -
poj 3622 Gourmet Grazers
无限orz把STL用得淋漓尽致的大牛。。。本题用贪心,先对cow的新鲜度进行降序,再对grass的新鲜度进行降序,方便待会在grass中查找符合grass[j].first>=cow[i].first的grass注意pair的排序是firs比second优先,unique返回唯一原创 2011-07-12 00:53:39 · 806 阅读 · 0 评论 -
【贪心】hdu 2863
#include #include #include #include #include #include #include #include #include #include #include #include #include #include原创 2011-08-26 00:26:30 · 575 阅读 · 0 评论 -
【codeforces #3】A——BFS+贪心
BFS不解释#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std;原创 2011-10-28 13:55:21 · 461 阅读 · 0 评论 -
【贪心】HDU 4137
咋一看,Manhattan Sort?纳尼?其实水题一道...运用了贪心,因为要总的移动的距离最小的最优办法就是直接把它挪到它应该放的地方,况且每个数都是唯一的struct node{ int id; int v;}p[33];bool cmp(node a,node b){ return a.v<b.v;}int main(){ int t;原创 2012-02-29 00:35:37 · 600 阅读 · 0 评论 -
【作业调度—贪心】POJ 2751
http://poj.org/problem?id=2751贪心策略见cmp函数,简单来说就是使得s1的作业及你快完成,以便尽快转到s2,注意s1没有空闲时间,而s2可能有空闲时间#define N 10005struct node{ int s1,s2;}p[N];/*bool cmp(node a,node b){ if(a.s1!=b.s1)retur原创 2012-03-16 20:29:18 · 1508 阅读 · 0 评论
分享