You have a backpack that can bear up to units of weight. Given objects, each with a weight and a value , compute the maximum sum of values achievable, in such a way that the sum of weights does not exceed . Take into account that objects cannot be cut: either you pick them, or you discard them.
Input consists of several cases. Every case begins with and , followed by pairs of integer numbers . Assume , , , and .
For every case, print the maximum value of the objects that can be stored in the backpack.
Author: Unknown
Translator: Salvador Roura
Generation: 2026-01-25T10:33:45.406Z
© Jutge.org, 2006–2026.
https://jutge.org