Knapsack problem/Unbounded

FCC link

A traveler gets diverted and has to make an unscheduled stop in what turns out to be Shangri-La. Opting to leave, he is allowed to take as much as he likes of the items available there, so long as it will fit in his knapsack, and he can carry it.

He knows that he can carry no more than a particular value of maximum weight in total; and that the capacity of his knapsack has a limited volume.

Looking just above the bar codes on the items he finds their weights and volumes. He digs out his recent copy of a financial paper and gets the value of each item.

He can only take whole units of any item, but there is much more of any item than he could ever carry.

Test

{{test}}

Console output