摘要:
http://acm.hdu.edu.cn/showproblem.php?pid=1203依旧是0/1背包的问题. 水题,秒杀之。。O(∩_∩)O哈哈~View Code 1 #include <stdio.h> 2 #define maxn 10005 3 double ans[maxn], w[maxn]; 4 int v[maxn]; 5 int main() 6 { 7 int n, m, i, j; 8 while(~scanf("%d%d",&m,&n),n||m) 9 {10 for(i = 0; i < n; i++)11 阅读全文
posted @ 2012-08-29 21:36
YORU
阅读(156)
评论(0)
推荐(0)
摘要:
http://acm.hdu.edu.cn/showproblem.php?pid=2602水题一道,依旧是0/1背包的问题。。。加深理解O(∩_∩)O~View Code 1 #include <iostream> 2 #define maxn 1005 3 using namespace std; 4 long ans[maxn], v[maxn], w[maxn]; 5 int main() 6 { 7 long t, n, m, i,j; 8 cin >> t; 9 while(t--)10 {11 cin >> n >> m;12 .. 阅读全文
posted @ 2012-08-29 20:38
YORU
阅读(131)
评论(0)
推荐(0)
摘要:
http://acm.hdu.edu.cn/showproblem.php?pid=2546依旧是0/1背包的问题。 只是 v,w相同。View Code 1 #include <iostream> 2 #include <algorithm> 3 #define maxn 1005 4 using namespace std; 5 int f[maxn],v[maxn]; 6 7 int main() 8 { 9 int n, m, i, j;10 while(cin >> n, n)11 {12 for(i = 0; i < n; i++)13 . 阅读全文
posted @ 2012-08-29 17:12
YORU
阅读(184)
评论(0)
推荐(0)
摘要:
http://acm.bnu.edu.cn/bnuoj/problem_show.php?pid=4183初学 0/1 背包,准备开始看背包.....View Code 1 #include <iostream> 2 #define maxn 1001 3 using namespace std; 4 int f[maxn][maxn], v[maxn], w[maxn], mark[maxn]; 5 int main() 6 { 7 int i, j, n, m, l, now; 8 cin >> n >> m; 9 for(i = 0; i <= 阅读全文
posted @ 2012-08-29 15:51
YORU
阅读(159)
评论(0)
推荐(0)
摘要:
http://acm.hdu.edu.cn/showproblem.php?pid=1671字典树的题目,在POJ上的时候字典树的话会因为不断开辟新的节点而消耗过多的时间,所以会开一个固定的空间.....但是我不知道该开多大的空间....o(╯□╰)o看别人的代码是开到 100000...话说我不知道为什么只要那么点就可以了....Code 1 #include <stdio.h> 2 #include <stdlib.h> 3 #include <string.h> 4 #include <iostream> 5 using namespace 阅读全文
posted @ 2012-08-29 09:54
YORU
阅读(137)
评论(0)
推荐(0)

浙公网安备 33010602011771号