-------------------------------------------------------------------- #include<cstdio> #include<algorithm> #include<iostream> #include<cstring> #define rep( i , n ) for( int i = 0 ; i < n ; ++i ) #define clr( x , c ) memset( x…
无限背包dp.. 因为题目中说至少到 H 磅 , 我就直接把 H * 2 了.. -------------------------------------------------------------------------- #include<cstdio> #include<algorithm> #include<cstring> #include<iostream> #define rep( i , n ) for( int i = 0 ; i…
描述 http://www.lydsy.com/JudgeOnline/problem.php?id=1606 价值和重量相等的01背包问题. 分析 ... #include <bits/stdc++.h> using namespace std; +,maxn=+; int n,W; int w[maxn],dp[maxw]; int main(){ scanf("%d%d",&W,&n); ;i<=n;i++) scanf("%d&quo…