#P6771. [USACO05MAR] Space Elevator 太空电梯
[USACO05MAR] Space Elevator 太空电梯
Problem Description
The cows are going to space. They plan to build a space elevator using blocks. There are types of blocks. Type has a fixed height and a certain quantity . To prevent cosmic rays from damaging the blocks, no part of any block of type may exceed height .
Please use these blocks to stack the tallest possible space elevator.
Input Format
The first line contains an integer .
Lines to : the -th line contains three integers , separated by spaces.
Output Format
One line containing one integer: the height of the space elevator.
3
7 40 3
5 23 8
2 52 6
48
Hint
Constraints for of the testdata: , , , .
Translated by ChatGPT 5