dp
minghan13
啊哦
展开
-
多重背包二进制优化
#include "bits/stdc++.h"using namespace std;const int maxn = 25000;int N, V;int w[maxn], v[maxn], dp[maxn];int main(){ cin >> N >> V; int cnt = 0; for (int i = 1; i <= N; i++){ int wi, vi, s; cin >> wi >> vi >>原创 2021-04-07 23:21:05 · 172 阅读 · 0 评论 -
完全背包:P1616 疯狂的采药
题目:P1616 疯狂的采药解析:完全背包模板题代码:#include "bits/stdc++.h"using namespace std;const int maxn = 1e7 + 7;long long int dp[maxn];long long int w[10010], v[10010];int main(){ int t, m; cin >> t >> m; for (int i = 0; i < m; i++){ cin >&原创 2021-04-07 22:40:05 · 187 阅读 · 0 评论 -
0-1背包习题:Charm Bracelet S
题目描述Bessie has gone to the mall’s jewelry store and spies a charm bracelet. Of course, she’d like to fill it with the best charms possible from the N (1 ≤ N ≤ 3,402) available charms. Each charm i in the supplied list has a weight Wi (1 ≤ Wi ≤ 400), a ‘de原创 2021-04-05 22:17:52 · 262 阅读 · 0 评论