Processing math: 100%
Knapsack 3 - MarisaOJ: Marisa Online Judge

Knapsack 3

Time limit: 1000 ms
Memory limit: 256 MB
There are n type of items, ith type item has the weight of wi, value of vi, and a quantity of ai. You can choose an arbitrary number items as long as their weight doesn't exceed a given S. Find a way of choosing items so that their value is maximum possible. ### Input - First line contains 2 integers n and S. - Each line in the next n line contains three integers wi,vi,ai. ### Output - The maximum possible value you can obtain. ### Constraints - 1≤n≤100,S≤104. - 1≤wi,vi,ai≤104. ### Example Input: 34142272361 Output: 15