文章分类 -  贪心算法

摘要:#include <stdio.h>#include <string.h>#include <stdlib.h>#include <algorithm>using namespace std;#define MAXN 111struct TNode{ int beg; int end;};TNode vTime[MAXN];bool visited[... 阅读全文
posted @ 2010-10-31 17:18 菜到不得鸟 阅读(100) 评论(0) 推荐(0)
摘要:#include #include using namespace std; #define MAXN 101struct TNode{ int beg; int end;};TNode time[MAXN]; inline bool myCmp(const TNode &t1, const TNode &t2){ return t1.end = time[j].end) ... 阅读全文
posted @ 2010-10-31 15:04 菜到不得鸟 阅读(114) 评论(0) 推荐(0)
摘要:#include <stdio.h>#include <iostream>#include <algorithm>using namespace std;#define MAXN 100000struct FNode{ int J, F;};bool myCmp(const FNode &f1, const FNode &f2){ return ... 阅读全文
posted @ 2010-10-19 21:13 菜到不得鸟 阅读(55) 评论(0) 推荐(0)
摘要:他可以收到至少一份offer的最大概率,即答案为1-最小失败率,贪心0ms,01背包15ms 贪心:#include <stdio.h>#include <string.h>#include <algorithm>using namespace std;#define MAXNUM 1005struct node{ int cost; double pro;}s... 阅读全文
posted @ 2010-08-30 16:34 菜到不得鸟 阅读(281) 评论(0) 推荐(0)
摘要:http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=3384#include <stdio.h>#define MAXN 1002int n;struct node{ int need,most,remained; int prepare;};node day[MAXN];int main(){ while(scan... 阅读全文
posted @ 2010-08-22 21:49 菜到不得鸟 阅读(144) 评论(0) 推荐(0)