CF36C.Bowls

普及/提高-

通过率:0%

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

注意这题要加上这个:

freopen("input.txt","r",stdin);
freopen("output.txt","w",stdout);

输入格式

Once Petya was in such a good mood that he decided to help his mum with the washing-up. There were nn 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.

输出格式

The first input line contains integer nn ( 1<=n<=30001<=n<=3000 ). Each of the following nn lines contains 3 integers hh , rr and RR ( 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.

输入输出样例

  • 输入#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
    
首页