#P2589. [ZJOI2006] 碗的叠放
[ZJOI2006] 碗的叠放
Description
Xiao H has bowls to put into a cupboard. She wants to stack them. Each bowl is a right circular frustum (wider at the top and narrower at the bottom). You have measured each bowl’s two radii and height. Please help Xiao H find a stacking order that minimizes the total height of the stack. For example:

Input Format
The first line contains an integer , the number of bowls. Each of the next lines contains three integers , , , denoting the bowl’s height and its two radii, where .
Output Format
Output a single number, the minimal height, rounded to the nearest integer.
3
50 30 80
35 25 70
40 10 90
55
Hint
Constraints: 100% of the testdata satisfies . The absolute value of every input number does not exceed 1000.
Translated by ChatGPT 5
京公网安备 11011102002149号