摘要: 0-1背包 基本思路 这是最基础的背包问题,特点是:每种物品仅有一件,可以选择放或不放。 用子问题定义状态:即f[i][v]表示前i件物品恰放入一个容量为v的背包可以获得的最大价值。则其状态转移方程便是: f[i][v]=max{f[i-1][v],f[i-1][v-c[i]]+w[i]} ... 阅读全文
posted @ 2015-10-11 16:38 StevenLuke 阅读(161) 评论(0) 推荐(0)
摘要: 背包问题http://love-oriented.com/pack/Index.html 虽然我不知道这是个什么网站。但这题是完全背包问题了。 #include #include int max(int a, int b);int main() { int t, n, i, j, d[100... 阅读全文
posted @ 2015-10-11 16:33 StevenLuke 阅读(129) 评论(0) 推荐(0)
摘要: #include #include using namespace std; int main() { int m1,m2,r1,r2,r3; string str; char ch; while(~scanf("%d%d",&m1,&m2))... 阅读全文
posted @ 2015-10-11 15:58 StevenLuke 阅读(122) 评论(0) 推荐(0)