You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
# if require is strictly equal the amountf= [0] + [inf] *amount# if require is largest value under amount ceilf= [0] * (amount+1)
# ZeroOne Pack: each stuff can only pick oneforiinrange(n):
forjinrange(amount, weight[i] -1):
f[j] =max(f[j], f[j-weight[i]] +value[i])
# Complate Pack: each stuff can pick unlimit timesforiinrange(n):
forjinrange(weight[i], amount+1):
f[j] =max(f[j], f[j-weight[i]] +value[i])
The text was updated successfully, but these errors were encountered:
The text was updated successfully, but these errors were encountered: