Lecture complete knapsack problem

There are  N  kinds of goods and a capacity V backpack, each item has infinite element is available.

The first  i  Volume kinds of goods is v i , the value is W I .

Which solving the items into the bag, the total volume of these items can not exceed the capacity of the backpack, and the total value of the maximum.
The maximum output value.

Input Format

The first line of two integers N, V, separated by spaces, each represent a kind of goods and a backpack volume.

Then there are  N  rows, each row two integers V I , W I , separated by spaces, respectively denote and the volume of the i-value of the items.

Output Format

Output An integer representing the maximum value.

data range

0<N,V≤1000
0<V in , w in ≤1000

SAMPLE INPUT

4 5
1 2
2 4
3 4
4 5

Sample output:

10

Guess you like

Origin www.cnblogs.com/yuhong1103/p/12509926.html