摘要: 题目链接:http://poj.org/problem?id=1276题目就是 重量=价值 的多重背包详细解法参照大牛们编写的《背包九讲》状态转移方程:f[i][v]=max{f[i-1][v-k*c[i]]+k*w[i]|0<=k<=n[i]}要注意在输入数据中cash N n1 D1 n2 D2 ... nN DNcash小于所有D1...DN的情况,这种情况输出0我的代码:#include <stdio.h>#include <stdlib.h>#include <string.h>int max(int a,int b){ if(a> 阅读全文
posted @ 2011-08-21 21:20 枫月寒 阅读(213) 评论(0) 推荐(0) 编辑