We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 6b85bbd commit 6586f9aCopy full SHA for 6586f9a
problems/背包问题理论基础完全背包.md
@@ -52,7 +52,7 @@ for(int i = 0; i < weight.size(); i++) { // 遍历物品
52
```CPP
53
// 先遍历物品,再遍历背包
54
for(int i = 0; i < weight.size(); i++) { // 遍历物品
55
- for(int j = weight[i]; j < bagWeight ; j++) { // 遍历背包容量
+ for(int j = weight[i]; j <= bagWeight ; j++) { // 遍历背包容量
56
dp[j] = max(dp[j], dp[j - weight[i]] + value[i]);
57
58
}
0 commit comments