夏夜、

心若平似镜、何题不AC。

上一页 1 2 3 4 5 6 7 ··· 15 下一页

2014年4月7日

POJ 1017 Packets 贪心 模拟

摘要: 一步一步模拟,做这种题好累先放大的的,然后记录剩下的空位有多少,塞1*1和2*2的进去//#pragma comment(linker, "/STACK:1024000000,1024000000")#include#include#include#include#include#include#include#include#include#include#include#include#include#includeusing namespace std;typedef long long ll;typedef unsigned long long ull;typede 阅读全文

posted @ 2014-04-07 19:54 BMan、 阅读(142) 评论(0) 推荐(0) 编辑

POJ 2394 Yogurt factory 贪心

摘要: 维护前i个星期是哪个的花费最少(包括储存的费用) minv=min(minv,C_i)//#pragma comment(linker, "/STACK:1024000000,1024000000")#include#include#include#include#include#include#include#include#include#include#include#include#include#includeusing namespace std;typedef long long ll;typedef unsigned long long ull;typede 阅读全文

posted @ 2014-04-07 17:15 BMan、 阅读(175) 评论(0) 推荐(0) 编辑

POJ 1328 Radar Installation 贪心

摘要: 把每个点转成区间,排序,首先考虑最左边的区间[l1,r1],要覆盖住这个点则需要在这个区间里的某个位置x放一个雷达,显然尽量放在靠右端是最好的,因为可以同时被右边的其他区间覆盖,但是要被右边的区间[l2,r2]覆盖还需满足l2#include#include#include#include#include#include#include#include#include#include#include#include#includeusing namespace std;typedef long long ll;typedef unsigned long long ull;typedef pai 阅读全文

posted @ 2014-04-07 13:23 BMan、 阅读(128) 评论(0) 推荐(0) 编辑

POJ 2376 Cleaning Shifts 贪心

摘要: 从左到右,如果需要覆盖当前点x那么就要选一个[l,r]满足l#include#include#include#include#include#include#include#include#include#include#include#include#includeusing namespace std;typedef long long ll;typedef unsigned long long ull;typedef pair pii;#define pb(a) push(a)#define INF 0x1f1f1f1f#define lson idx T min(const T& 阅读全文

posted @ 2014-04-07 12:12 BMan、 阅读(135) 评论(0) 推荐(0) 编辑

2014浙大校赛

摘要: ZOJ 3767 Elevator求和,签到题//#pragma comment(linker, "/STACK:1024000000,1024000000")#include#include#include#include#include#include#include#include#include#include#include#include#include#includeusing namespace std;typedef long long ll;typedef unsigned long long ull;typedef pair pii;#define p 阅读全文

posted @ 2014-04-07 10:51 BMan、 阅读(292) 评论(0) 推荐(0) 编辑

2014年4月6日

POJ 3050 Hopscotch 暴力 DFS

摘要: DFS枚举每个点开始的全部长度为6的数字串,插入到set里面。//#pragma comment(linker, "/STACK:1024000000,1024000000")#include#include#include#include#include#include#include#include#include#include#include#include#include#includeusing namespace std;typedef long long ll;typedef unsigned long long ull;typedef pair pii;# 阅读全文

posted @ 2014-04-06 11:58 BMan、 阅读(305) 评论(0) 推荐(0) 编辑

POJ 3187 Backward Digit Sums 枚举

摘要: 用next_permutation枚举全排列。//#pragma comment(linker, "/STACK:1024000000,1024000000")#include#include#include#include#include#include#include#include#include#include#include#include#include#includeusing namespace std;typedef long long ll;typedef unsigned long long ull;typedef pair pii;#define p 阅读全文

posted @ 2014-04-06 11:40 BMan、 阅读(135) 评论(0) 推荐(0) 编辑

POJ 2718 Smallest Difference 贪心构造

摘要: 不用说,想让两个数的差最小,那这个两个数的位数要最接近。不妨设a>b;如果n是奇数 a就是最小的(n/2+1)位数,b就是最大的n/2位数如果是偶数 枚举每一对相邻的数,大的作为a的第一位,小的作为b的第一位,然后就一样了。//#pragma comment(linker, "/STACK:1024000000,1024000000")#include#include#include#include#include#include#include#include#include#include#include#include#include#includeusing 阅读全文

posted @ 2014-04-06 11:24 BMan、 阅读(162) 评论(0) 推荐(0) 编辑

POJ 3009 Curling 2.0 DFS

摘要: 读懂题意就能写了,递归层数最多10,怎么写都能过。DFS://#pragma comment(linker, "/STACK:1024000000,1024000000")#include#include#include#include#include#include#include#include#include#include#include#include#include#includeusing namespace std;typedef long long ll;typedef unsigned long long ull;typedef pair pii;#de 阅读全文

posted @ 2014-04-06 10:38 BMan、 阅读(109) 评论(0) 推荐(0) 编辑

2014年4月5日

POJ 1979 Red and Black DFS

摘要: 简单DFS。//#pragma comment(linker, "/STACK:1024000000,1024000000")#include#include#include#include#include#include#include#include#include#include#include#include#include#includeusing namespace std;typedef long long ll;typedef unsigned long long ull;typedef pair pii;#define pb(a) push(a)#defi 阅读全文

posted @ 2014-04-05 23:32 BMan、 阅读(140) 评论(0) 推荐(0) 编辑

上一页 1 2 3 4 5 6 7 ··· 15 下一页

导航