Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[pull] main from itcharge:main #73

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
pull merged 13 commits into AlgorithmAndLeetCode:main from itcharge:main
Mar 27, 2023
Merged
Changes from 1 commit
Commits
Show all changes
13 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Update Pack-CompletePack.py
  • Loading branch information
itcharge committed Mar 27, 2023
commit 3effbca39a7bd3198daddac24627cfe1e87cc8fe
2 changes: 1 addition & 1 deletion Templates/10.Dynamic-Programming/Pack-CompletePack.py
View file Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ def completePackMethod1(self, weight: [int], value: [int], W: int):
for i in range(1, size + 1):
# ζžšδΈΎθƒŒεŒ…θ£…θ½½ι‡ι‡
for w in range(W + 1):
# 枚举第 i 种物品能取δΈͺζ•°
# 枚举第 i - 1 种物品能取δΈͺζ•°
for k in range(w // weight[i - 1] + 1):
# dp[i][w] ε–ζ‰€ζœ‰ dp[i - 1][w - k * weight[i - 1] + k * value[i - 1] δΈ­ζœ€ε€§ε€Ό
dp[i][w] = max(dp[i][w], dp[i - 1][w - k * weight[i - 1]] + k * value[i - 1])
Expand Down

AltStyle γ«γ‚ˆγ£γ¦ε€‰ζ›γ•γ‚ŒγŸγƒšγƒΌγ‚Έ (->γ‚ͺγƒͺγ‚ΈγƒŠγƒ«) /