U11Try6
This commit is contained in:
parent
bdbb2e0a11
commit
e9e8d21971
@ -4,6 +4,11 @@ def maximum_value(maximum_weight, items):
|
||||
return 0
|
||||
if items == 0 or items is None or items ==[]:
|
||||
return 0
|
||||
if len(items) == 1:
|
||||
curent_dic = items[0]
|
||||
weight = curent_dic.get("weight")
|
||||
if weight > maximum_weight:
|
||||
return 0
|
||||
#ділимо на лісти
|
||||
weight = []
|
||||
value = []
|
||||
@ -27,8 +32,9 @@ def maximum_value(maximum_weight, items):
|
||||
|
||||
if weight[index] <=zostava:
|
||||
better = max(better,value[index] + vyries(pocet - 1,zostava - weight[index]))
|
||||
pamat[stav] = better
|
||||
return better
|
||||
|
||||
pamat[stav] = better
|
||||
return better
|
||||
|
||||
return vyries(len(weight),maximum_weight)
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user