Data update

This commit is contained in:
Ingy döt Net 2024-10-16 18:07:41 -07:00
parent 81fd053722
commit 52a6ef48dd
10248 changed files with 63654 additions and 6775 deletions

View file

@ -4,7 +4,7 @@ value[] = [ 150 35 200 160 60 45 60 40 30 10 70 30 15 10 40 70 75 80 20 12 50 10
max_w = 400
#
proc solve i maxw . items[] wres vres .
if i <= 0
if i = 0
wres = 0
vres = 0
items[] = [ ]
@ -13,19 +13,17 @@ proc solve i maxw . items[] wres vres .
else
solve i - 1 maxw items[] wres vres
solve i - 1 maxw - weight[i] items1[] w1 v1
v1 += value[i]
if v1 > vres
if v1 + value[i] > vres
swap items[] items1[]
items[] &= i
wres = w1 + weight[i]
vres = v1
vres = v1 + value[i]
.
.
.
solve len weight[] max_w items[] w v
print "weight: " & w
print "value: " & v
print "items:"
print "weight: " & w & " value: " & v
write "items:"
for item in items[]
print " " & name$[item]
write " " & name$[item]
.