Knapsack problem/Bounded: Difference between revisions

m
cap all comment
m (added to distro)
m (cap all comment)
Line 2,315:
 
function cap(sequence s)
-- cap the last entry to something that will fit:
-- (it would be perfectly valid to cap all entries,
-- but only the last one will make any difference.)
integer {witem,?,mitem} = s[$][2]
s[$][2][3] = min(floor(400/witem),mitem)
7,805

edits