luogu#P1507. NASA的食物计划
NASA的食物计划
Background
NASA (National Aeronautics and Space Administration) has long struggled with safety technologies such as the thermal protection tiles on the space shuttle. Under various pressures, the history of the space shuttle program was brought to an end. However, no one can guarantee that similar issues will not occur in the future. Thus, when such spaceflight problems arise, astronauts may have to perform extravehicular repairs. Excessive repairs, however, consume a large amount of the astronauts’ energy. Therefore, NASA wants to design a food plan to load as many high-calorie foods as possible under limited volume and load-bearing capacity.
Problem Description
The space shuttle has limited volume, and carrying overly heavy items wastes a lot of fuel money. Each food item has its own volume, mass, and contained calories. Given the maximum allowable volume and mass, output the maximum total calories achievable. Each food item can be used at most once.
Input Format
The first line contains integers, representing the maximum volume and the maximum mass .
The second line contains integer representing the total number of food items .
The next lines each contain numbers: volume , mass , and contained calories .
Output Format
One integer, representing the maximum total calories achievable (within int range).
320 350
4
160 40 120
80 110 240
220 70 310
40 400 220
550
Hint
For of the testdata, , , .
Translated by ChatGPT 5