![](https://img-blog.csdnimg.cn/20201014180756927.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
01背包
knownothing
这个作者很懒,什么都没留下…
展开
-
hdu 2955 Robberies 01背包变形
#include #include #include #include double f[10001];double maxn;double maxs(double a,double b){ return a-b>1e-12?a:b;}int main(){ int T; scanf("%d",&T); while(T--) {原创 2013-07-18 14:56:45 · 556 阅读 · 0 评论 -
poj 2184 Cow Exhibition 01背包变形,正负背包
#include #include #define INF 1000000000int f[210001],c[101],w[101];int max(int a,int b){ return a>b?a:b;}int main(){ int n; while(scanf("%d",&n)!=EOF) { int i,j,k,s=0,原创 2013-07-18 19:15:34 · 565 阅读 · 0 评论 -
hdu2639 Bone Collector II 01背包第K优解
#include #include #include using namespace std;int f[1001][33];//f[i][j]表示i体积下第j优解int c[1001],w[1001];int max(int a,int b){ return a>b?a:b;}int main(){ int T; scanf("%d",&T);转载 2013-07-18 16:32:45 · 963 阅读 · 0 评论 -
hdu 2602 Bone Collector 01背包
#include #include #include using namespace std;int f[1001];int c[1001],w[1001];int max(int a,int b){ return a>b?a:b;}int main(){ int T; scanf("%d",&T); while(T--) {原创 2013-07-18 15:50:54 · 495 阅读 · 0 评论 -
poj 3624 Charm Bracelet 01背包
#include #include int f[13000];int c[3500],w[3500];int max(int a,int b){ return a>b?a:b;}int main(){ int n,m; while(scanf("%d%d",&n,&m)!=EOF) { int i,j,k; for(i原创 2013-07-18 16:39:41 · 501 阅读 · 0 评论 -
poj 3211 Washing Clothes 01背包
#include #include int f[50000];int c[3500],w[3500];char color[11][11];int max(int a,int b){ return a>b?a:b;}struct node{ int a; char b[11];}e[101];int main(){ int m,n; w原创 2013-07-18 16:59:53 · 610 阅读 · 0 评论 -
poj 3628 Bookshelf 2 01背包或者dfs
#include #include int f[1000001],c[22];int max(int a,int b){ return a>b?a:b;}int main(){ int n,m; while(scanf("%d%d",&n,&m)!=EOF) { int i,j,k,s=0; for(i=0;i<n;i+原创 2013-07-18 18:31:15 · 652 阅读 · 0 评论 -
hdu 1709 The Balance 正负背包(01背包)
#include #include #include #include #include #include #include #include using namespace std;const int maxn=105;const int INF=1e8;int f[maxn*maxn];int a[maxn];int e[maxn*maxn];int main()原创 2013-09-17 20:12:36 · 823 阅读 · 0 评论