Problem1024--0-1 knapsack problem with maximum k items

1024: 0-1 knapsack problem with maximum k items

[Creator : ]
Time Limit : 1.000 sec  Memory Limit : 128 MiB

Description

Given weights and values of N items, pickup no more than K items and put them in a knapsack of capacity W to get the maximum total value in the knapsack.
(For this question, N <= 25 )

Input

The first line contains three integers N W and K,
the following N lines, each line contains two integers w and v which is the weight and value of the item

Output

One integer which is the total value of the chosen items

Sample Input Copy

5 6 3
2 1
2 3
3 3
7 6
9 8

Sample Output Copy

6

Source/Category