摘要:
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2639 题目大意:给出一行价值,一行体积,让你在v体积的范围内找出第k大的值.......(注意,不要 和它的第一题混起来,它第一行是价值,再是体积) 思路:首先dp[i][j]代表的是在体积为i的时候第 阅读全文
posted @ 2020-09-09 17:18
quanjun
阅读(109)
评论(0)
推荐(0)
摘要:
题目链接:https://www.luogu.com.cn/problem/P1757 解题思路: 所谓分组背包,就是将物品分组,每组的物品相互冲突,最多只能选一个物品放进去。 这种题怎么想呢?其实是从「在所有物品中选择一件」变成了「从当前组中选择一件」,于是就对每一组进行一次 0-1 背包就可以了 阅读全文
posted @ 2020-09-09 16:28
quanjun
阅读(271)
评论(0)
推荐(0)
摘要:
题目链接:https://www.luogu.com.cn/problem/P1507 解题思路:二维费用背包模板题。 示例代码: #include <bits/stdc++.h> using namespace std; const int maxn = 505; int v1, v2, n, f 阅读全文
posted @ 2020-09-09 14:05
quanjun
阅读(121)
评论(0)
推荐(0)
摘要:
题目链接:https://www.luogu.com.cn/problem/P5662 解题思路: 我们进行 \(t−1\) 轮 完全背包 : 把今天手里的钱当做背包的容量, 把商品今天的价格当成它的消耗, 把商品明天的价格当做它的价值。 示例代码: #include <bits/stdc++.h> 阅读全文
posted @ 2020-09-09 13:37
quanjun
阅读(288)
评论(0)
推荐(0)
浙公网安备 33010602011771号