CF36C.Bowls
提高+/省选-
通过率:0%
时间限制:2.00s
内存限制:64MB
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
Once Petya was in such a good mood that he decided to help his mum with the washing-up. There were n dirty bowls in the sink. From the geometrical point of view each bowl looks like a blunted cone. We can disregard the width of the walls and bottom. Petya puts the clean bowls one on another naturally, i. e. so that their vertical axes coincide (see the picture). You will be given the order in which Petya washes the bowls. Determine the height of the construction, i.e. the distance from the bottom of the lowest bowl to the top of the highest one.

有一次,佩蒂亚心情特别好,决定帮妈妈洗碗。水槽里有 n 个脏碗。从几何角度看,每个碗的形状都类似于一个截头圆锥(即圆台)。我们可以忽略碗壁和碗底的厚度。佩蒂亚将洗净的碗自然地一个叠在另一个上面,即让它们的竖直轴线重合(见图)。你将获知佩蒂亚洗碗的顺序。请计算这一叠碗的总高度,即从最底部碗的底面到最顶部碗的顶面之间的距离。

输入格式
The first input line contains integer n (1 ≤ n ≤ 3000). Each of the following n lines contains 3 integers h, r and R (1 ≤ h ≤ 10000, 1 ≤ r < R ≤ 10000). They are the height of a bowl, the radius of its bottom and the radius of its top. The plates are given in the order Petya puts them on the table.
第一行输入包含一个整数 n(1≤n≤3000)。接下来的 n 行每行包含三个整数 h、r 和 R(1≤h≤10000,1≤r<R≤10000),分别表示一个碗的高度、底部半径和顶部半径。这些碗按小彼佳将它们放置到桌面上的顺序给出。
输出格式
Output the height of the plate pile accurate to at least 10 - 6.
输出板桩的高度,精确到至少 10−6。
输入输出样例
输入#1
2 40 10 50 60 20 30
输出#1
70.00000000
输入#2
3 50 30 80 35 25 70 40 10 90
输出#2
55.00000000
输入解题思路,AI测评打分。不知道怎么写?