Replies: 30 comments 10 replies
-
@yizimi-yuanxin 是哒,路漫漫其修远兮,大佬有没有兴趣参与其中 |
Beta Was this translation helpful? Give feedback.
-
为什么不用数组来表示,Fi,w 这样的表达有些模糊,不好理解 |
Beta Was this translation helpful? Give feedback.
This comment has been hidden.
This comment has been hidden.
-
01背包的核心代码为何看不懂,,, |
Beta Was this translation helpful? Give feedback.
-
感觉讲解的很简洁,有一点难以理解,希望扩充一下~ |
Beta Was this translation helpful? Give feedback.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment has been hidden.
This comment has been hidden.
This comment has been hidden.
This comment has been hidden.
This comment has been hidden.
This comment has been hidden.
This comment has been hidden.
This comment has been hidden.
This comment has been hidden.
This comment has been hidden.
This comment has been hidden.
This comment has been hidden.
This comment was marked as off-topic.
This comment was marked as off-topic.
-
优化的地方打错了吧... |
Beta Was this translation helpful? Give feedback.
-
输出方案那一小节是不是有点问题, v代表的是背包容量, 下面的代码应该是减掉第 i 项物品的重量吧? if (g[i][v]) {
选了第 i 项物品;
v -= 第 i 项物品的价值; |
Beta Was this translation helpful? Give feedback.
-
还有小数背包呀? |
Beta Was this translation helpful? Give feedback.
-
感觉多重背包是不是讲复杂了?感觉可以实现 for (int i = 1; i <= n; i++)
int cnt = 0; // 选择的次数
for (int l = w[i]; l <= W; l++)
if (f[l - w[i]] + v[i] > f[l] && cnt<k[i]) {
f[l] = f[l - w[i]] + v[i]; // 核心状态方程
cnt++;
} |
Beta Was this translation helpful? Give feedback.
-
@Maxpicca-Li 你再想想? |
Beta Was this translation helpful? Give feedback.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as spam.
This comment was marked as spam.
-
背包问题,其实就是在约束条件下,求极大问题,我理解的对吗。 |
Beta Was this translation helpful? Give feedback.
-
很简洁清楚谢谢大哥(^o^)/ |
Beta Was this translation helpful? Give feedback.
-
完全背包-过程 |
Beta Was this translation helpful? Give feedback.
-
https://oi-wiki.org/dp/backpack/
Beta Was this translation helpful? Give feedback.
All reactions