diff --git a/u11/knapsack.py b/u11/knapsack.py index 52b6459..6a58dca 100644 --- a/u11/knapsack.py +++ b/u11/knapsack.py @@ -27,11 +27,6 @@ def maximum_value_with_items(maximum_weight, items): stav = {0: (0,[])} for item in items: - w = item["weight"] - v = item["value"] - Novystav = dict(stav) - - for item in items: w = item["weight"] v = item["value"] Novystav = dict(stav) @@ -43,7 +38,7 @@ def maximum_value_with_items(maximum_weight, items): if NewV > Novystav.get(NEwW, (0, []))[0]: Novystav[NEwW] = (NewV, vibir + [item]) - stav = Novystav + stav = Novystav BV = 0 Bvibir = []