摘要: P5020 [NOIP2018 提高组] 货币系统 #include<cstdio> #include<algorithm> #include<cstring> using namespace std; const int MAXAI=25005; const int MAXN=105; int f 阅读全文
posted @ 2022-03-24 09:27 心悟&&星际 阅读(24) 评论(0) 推荐(0) 编辑
摘要: p1616 疯狂的采药 #include<iostream> #include<vector> using namespace std; const int Maxn=10000001; int a[Maxn],b[Maxn],dp[Maxn]; int main() { // freopen("p 阅读全文
posted @ 2022-03-24 09:24 心悟&&星际 阅读(22) 评论(0) 推荐(0) 编辑
摘要: 完全背包 此类背包问题中,我们的每种物品有无限多个,可重复选取。 类似于01背包,我们依旧需要考虑前i-1件物品的影响。 此时我们依旧可以设得二维状态 f[i][v]代表用i件物品填充为体积为v的背包得到的最大价值 依旧很容易写出状态转移方程 f[i][v]=max(f[i−1][v],f[i−1] 阅读全文
posted @ 2022-03-24 09:21 心悟&&星际 阅读(34) 评论(0) 推荐(0) 编辑