maxm=10000 v=[150,200,350] t=int(raw_input()) for ii in range(0,t): m=int(raw_input()) f=[] for j in range(0,m+1): f.append(m) for i in range(0,3): for j in range(1,m+1): if j>=v[i]: f[j]=min(f[j],f[j-v[i]]-v[i]) print f[m]
完全背包
maxm=10000 v=[150,200,350] t=int(raw_input()) for ii in range(0,t): m=int(raw_input()) f=[] for j in range(0,m+1): f.append(m) for i in range(0,3): for j in range(1,m+1): if j>=v[i]: f[j]=min(f[j],f[j-v[i]]-v[i]) print f[m]
完全背包