![](https://img-blog.csdnimg.cn/20201014180756754.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
背包问题
muczzcy
这个作者很懒,什么都没留下…
展开
-
CTSC 97 选课 ----树形依赖背包
树形依赖背包问题:给定n件物品和一个背包。第 i 件物品的价值是 wi ,其体积为 Vi ,但是依赖于第 Xi 件物品(必须选取 Xi 后能取 i ,如果无依赖则 Xi = 0),依赖关系形成森林,背包的容量为 C 。可以任意选择装入背包中的物品,求装入背包中物品的最大总价值。 Code: #include #include using namespace std; c原创 2013-11-20 20:36:13 · 1884 阅读 · 1 评论 -
NOIP 金明的预算 ---- 依赖树形背包
同上题。 #include #include using namespace std; const int maxn = 60;//总个数 const int maxm = 3200;//总钱数 int n,c; int x[maxn],w[maxn],v[maxn]; int f[maxn][maxm]; inline int dfs(int k,int原创 2013-11-20 20:39:25 · 1112 阅读 · 0 评论 -
hrbust 1992 比赛积分
SoL:01背包。。。 #include #include #include #include using namespace std; const int maxm = 1000 + 10; const int maxn = 100 + 10; int dp[maxm]; int value[maxn];//每袋的价格 int weight[maxn];//每袋的重量 int原创 2014-01-15 22:02:39 · 697 阅读 · 0 评论 -
hrbust 1993 数硬币
SoL;完全背包。。。 #include #include #include #include using namespace std; const int INF = 0x3f3f3f3f; const int maxm = 10000 + 10; const int maxn = 50 + 10; int dp[maxm]; int value[maxn];//每袋的价格 in原创 2014-01-15 22:04:11 · 635 阅读 · 0 评论 -
hdu 1114 Piggy-Bank 完全背包
已知空的储钱罐和装了硬币的储钱罐的质量。然后给了n种硬币的质量和价值。 问储钱罐里最少有多少钱。 Sol:完全背包 #include #include #include #include using namespace std; const int INF = 0x3f3f3f3f; const int maxm = 10000 + 10; c原创 2014-01-15 20:17:51 · 731 阅读 · 0 评论