Cod sursa(job #2523625)
Utilizator | Data | 14 ianuarie 2020 15:04:29 | |
---|---|---|---|
Problema | Problema rucsacului | Scor | 0 |
Compilator | py | Status | done |
Runda | Arhiva educationala | Marime | 0.43 kb |
from pathlib import Path
txt = Path("rucsac.in").read_text().split('\n')
txt = [ t.split(' ') for t in txt ]
""""#print(txt)
n = int(txt[0][0])
g = int(txt[0][1])
#print(n,g)
v = [0]*(g+1)
#print(v)
"""
'''for greutate,profit in txt[1:n+1]:
for x in range(g,-1,-1):
if x-greutate >=0:
v[x] = max(v[x],v[x-greutate]+profit)
Path("rucsac.out").write_text(str(v[-1]))
'''