1022: 0-1 knapsack problem
[Creator : ]
Description
Given weights and values of N items, put these items in a knapsack of capacity W to get the maximum total value in the knapsack.
(For this question, N <= 25 )
(For this question, N <= 25 )
Input
The first contains two integers which is N and W
The following N lines, each line contains two integer w and v which is the weight and value of the item
The following N lines, each line contains two integer w and v which is the weight and value of the item
Output
One integer which the maximum total value for the items can be put into the bag
Sample Input Copy
4 5
2 4
3 5
1 3
4 7
Sample Output Copy
10