Data update

This commit is contained in:
Ingy döt Net 2023-09-16 17:28:03 -07:00
parent 5af6d93694
commit 796d366b97
455 changed files with 7413 additions and 1900 deletions

View file

@ -4,28 +4,28 @@ 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
wres = 0
vres = 0
items[] = [ ]
elif weight[i] > maxw
call solve i - 1 maxw items[] wres vres
else
call solve i - 1 maxw items[] wres vres
call solve i - 1 maxw - weight[i] items1[] w1 v1
v1 += value[i]
if v1 > vres
swap items[] items1[]
items[] &= i
wres = w1 + weight[i]
vres = v1
.
.
if i <= 0
wres = 0
vres = 0
items[] = [ ]
elif weight[i] > maxw
solve i - 1 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
swap items[] items1[]
items[] &= i
wres = w1 + weight[i]
vres = v1
.
.
.
call solve len weight[] max_w items[] w v
solve len weight[] max_w items[] w v
print "weight: " & w
print "value: " & v
print "items:"
for i = 1 to len items[]
print " " & name$[items[i]]
for item in items[]
print " " & name$[item]
.