摘要:
链接:http://acm.hdu.edu.cn/showproblem.php?pid=1114这道题是要找最小的可能值,所以初始化的时候要注意一下不同。完全背包的题,要注意总结这些模版题View Code 1 #include<stdio.h> 2 #include<string.h> 3 #define MAXA 1000000000 4 #define N 10005 5 #define M 505 6 int a[N]; 7 int wei[M]; 8 int val[M]; 9 int min(int a,int b)10 {11 return a<b 阅读全文
posted @ 2012-05-01 16:46
zhenhai
阅读(215)
评论(0)
推荐(0)
摘要:
链接:http://acm.hdu.edu.cn/showproblem.php?pid=2602最基本的01背包问题,现在发现需要好好的搞搞基础题了,校赛的一个多重背包竟然没做出来。View Code 1 #include<stdio.h> 2 #include<string.h> 3 #define N 1005 4 int a[N]; 5 int v[N]; 6 int val[N]; 7 int max(int a,int b) 8 { 9 return a>b?a:b;10 }11 int main()12 {13 int t,n,i,j,k,m;14 阅读全文
posted @ 2012-05-01 15:12
zhenhai
阅读(183)
评论(0)
推荐(0)

浙公网安备 33010602011771号