
多重背包
空白君有着一把空白键blanKey
即使世界如此残酷,我们仍是努力挣扎着
/*算了,退役了,不挣扎了QWQ*/
展开
-
POJ2392 Space Elevator (多重背包)
题目点我点我点我题意:有一群奶牛向上太空,然后要用一块块塔搭上去,给出K种类型的塔,每种类型单块高度为h,在a高度一下都可以搭建,有c块。思路:多重背包问题,在进行多重背包之前要进行一次排序,将最大高度小的放在前面,只有这样才能得到最优解,如果将大的放在前面,后面有的小的就不能取到,排序之后就可以进行完全背包了。 注意这题只有花费,没有价值,利用dp记录能搭建的所有高度的情况,能搭原创 2015-11-13 16:46:56 · 471 阅读 · 0 评论 -
poj1276 Cash Machine(多重背包)
题目点我点我点我题意:给你一个cash,然后有N种价值为D,数量为n的钱币,要求凑出最接近cash的价值。 多重背包。#include <iostream> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <math.h> #include <algorithm> using namespace std;原创 2015-11-12 23:49:40 · 392 阅读 · 0 评论 -
hdu1059 Dividing (多重背包)
链接点我点我点我 简单多重背包#include <iostream> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <math.h> #include <algorithm> using namespace std; int dp[120100],a[7]; int v,k; //v为体积void Zero原创 2015-11-12 22:12:44 · 383 阅读 · 0 评论 -
hdu2191 题目太长不打了orz(多重背包)
第一次见这么长的题目…… 多重背包,可以说背包九讲的模版题。#include <iostream> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <math.h> #include <algorithm> using namespace std; int v; int dp[105],p[105],h[105原创 2015-11-12 22:42:05 · 524 阅读 · 0 评论