贪心
傻笨
这个作者很懒,什么都没留下…
展开
-
HDU 2037
这是一道经典的贪心题,活动安排#include #include #include #include #include #include using namespace std;const int maxn=105;int n;struct node{ int x; int y;}p[maxn];int cmp(node a,node b){原创 2013-08-03 12:30:48 · 475 阅读 · 0 评论 -
HDU 2390
我发现贪心的典型题目就是活动安排,这是一道入门贪心!#include #include #include #include #include #include using namespace std;const int maxn=50005;int m,t;struct node{ int day; int start; int end;} p原创 2013-08-03 14:42:31 · 598 阅读 · 0 评论 -
HDU 1009
这道贪心题目类型跟上次不同,不是活动安排,题目大意是:有m个猫粮,n个房间,下面n组数据,每组两个,分别代表的是:把猫粮放到房间里能得到多少价值,第二个数是一个房间放的猫粮!#include #include #include #include #include #include using namespace std;const int maxn=1005原创 2013-08-03 16:14:33 · 518 阅读 · 0 评论 -
poj 1922
#include #include #include #include #include using namespace std;const int inf=0x3f3f3f3f;const int maxn=10005;int n;struct node{ int x; int y; double time;}p[maxn原创 2013-08-03 18:15:04 · 541 阅读 · 0 评论 -
HDU 3177
这道题目首先要理解题意:给你一个洞的体积V,然后放N件物品,然后给出N组数据,分别代表的意思是:停放体积 移动体积然后你想想:按照两者相差值按照由大到小排序,这个慢慢体会一下!#include #include #include #include #include #include #include using namespace std;const int maxn=1005原创 2013-08-03 20:31:05 · 573 阅读 · 0 评论 -
Commando War, UVa 11729
/* Commando War, UVa 11729 贪心题目*/#include #include #include #include #include using namespace std;const int maxn=1005;int n;struct node{ int b; int j;} p[maxn];int cmp(n原创 2013-08-04 22:11:47 · 515 阅读 · 0 评论 -
UVA 11292 和 UVA 11729
最近开始刷刘汝佳的大白书,这两道原创 2014-05-15 21:43:49 · 634 阅读 · 0 评论 -
区间取点问题
数轴上有n个闭区间[ai,bi]。取尽量少的点,使得每个区间内都至少有一个点(不同区间内含的点可以是同一个)。例题如下:N one dimensional kingdoms are represented as intervals of the form [ai , bi] on the real line.A kingdom of the form [L, R] can be destro原创 2015-01-11 16:11:00 · 1139 阅读 · 0 评论