Limited Stock Knapsack
Each item i has weight wi, value vi, and is available at most ci times. Maximize value within capacity W.
Input: the first line has N and W; each of the next N lines has wi vi ci.
Output: the maximum achievable value.
Constraints:
- 1 ≤ N ≤ 100
- 1 ≤ W ≤ 104
- 1 ≤ ci ≤ 1000
Sample Tests
Input 1
2 5 2 3 2 3 4 1
Output 1
7
Input 2
1 4 2 5 3
Output 2
10
Discussion (opens after you solve — no spoilers before)
No comments yet.