背包
knownothing
这个作者很懒,什么都没留下…
展开
-
hdu 4501 多维01背包
#include #include #include #include #include #include #include using namespace std; int f[101][101][6]; int a[101],b[101],c[101]; int n,v1,v2,kk; int main() { while(scanf("%d%d%d%d",&n,&v1,转载 2013-08-18 15:54:22 · 873 阅读 · 0 评论 -
hdu 4104 Discount 01背包变形+优化
题意:就是输入一个商品数n和所有商品的价格,问最小不能组合的价格是多少? 题解:我直接想到的是01背包。。,直接来肯定要TLE的,需要优化下,别人不知道是用什么方法,我自己是用这个接的,就是不知道最坏情况能不能过了。。没计算过 这题中说是01背包变形,其实就是个dp,以已知可以拼凑的价格推出另一个价格,写法跟01背包很想,尤其是两个for。可以理解成将n个体积为价格值,价值为0的物品,放入没有原创 2013-10-03 17:02:32 · 1110 阅读 · 0 评论 -
hdu 2159 FATE 二维背包
#include #include #include #include #include using namespace std; #define LL __int64 const int maxn=110; const int INF=1e8; int a[maxn],b[maxn],f[maxn][maxn],m,s,k,n; int main() { while(cin>>原创 2013-09-19 12:37:51 · 629 阅读 · 0 评论