CodeVita 2017 Round 2 C
CodeVita 2017 Round 2 C
CodeVita 2017 Round 2 C
Welcome Home Coding Arena Compile & Run Submissions Graphs Feedback
Time Left
Coding Arena 06 00 00
Change Default Language hr min sec
A B C D E F G H
Second line gives space separated N positive real numbers with up to 1 decimal place giving the radii of the balloons.
Third line gives K, the rate of reduction in the volume of air as a percentage.
Output Format:
Maximum sum of volumes of all the balloons on the Nth day when all the balloons are filled. Take 3.14 as the value of PI and
give the answer to two decimal places (truncated by ignoring all the decimals from third onwards). Note that the truncation
should happen only after computing the volume of all the balloons on the final day to maximum precision.
Constraints:
Example 1
Input
5
8 4 6 10 3
10
Output
7117.88
Explanation
If we fill the balloons in the order 3, 4, 6, 8, 10, their volumes on the fifth day are respectively
74.165544
195.33312
732.4992
1929.216
4186.666667
And their sum is 7117.880531. Truncating the value two decimal places, we obtain 7117.88
Example 2
Input
7
3.5 9 4 6.6 7 11 9.1
12.5
Output
12555.35
Explanation
If we inflate the balloons in the order 3.5 4 6.6 7 9 9.1 11, their volumes on the seventh day would be respectively
80.56025567
137.4322396
705.5574848
962.0256771
2336.74875
2760.581763
5572.453333 The sum of these volumes is 12555.3595 and truncating to two decimal places, we obtain 12555.35
https://www.tcscodevita.com/CodevitaV6/problemstart.jsp 1/2
11/08/2017 TCS: CodeVita - Coding Arena
Note:
Please do not use package and namespace in your code. For object oriented languages your code should be written in one
class.
Note:
Participants submitting solutions in C language should not use functions from <conio.h> / <process.h> as these files do not
exist in gcc
Note:
Submit Answer
Select Language
Select File
Browse...
© 2017 Tata Consultancy Services Limited. All Rights Reserved. In Association with | Privacy Policy
https://www.tcscodevita.com/CodevitaV6/problemstart.jsp 2/2