#P1776. 宝物筛选
宝物筛选
Description
At last, the millennium-old puzzle was solved. Xiao FF found the royal treasure vault, filled with countless priceless treasures.
Xiao FF is about to get rich. However, there are simply too many treasures, and his collection cart cannot hold them all. He has to give up some of them.
Xiao FF sorted the treasures in the cave and found that each type of treasure has one or more copies. He roughly estimated the value of each type and then began the selection: the collection cart has a maximum load of . There are types of treasures in total. For each type, the value is , the weight is , and there are copies. Under the constraint that the cart does not exceed its load, Xiao FF wants to choose some treasures to put into the cart so that the total value is maximized.
Input Format
The first line contains two integers and , representing the number of types of treasures and the maximum load of the collection cart.
The next lines each contain three integers .
Output Format
Output a single integer, the maximum total value of treasures that can be collected without exceeding the cart’s load.
4 20
3 9 3
5 9 1
9 4 2
8 1 3
47
Hint
For of the testdata, ,,.
For of the testdata, ,,,.
Translated by ChatGPT 5
京公网安备 11011102002149号