[BOJ 9776] Max Volume

View as PDF

Submit solution

Points: 1
Time limit: 1.0s
Memory limit: 128M

Problem types
Allowed languages
Assembly, Awk, C, C++, Java, Pascal, Perl, Python, Sed, Text

Write a program to find the maximum volume of given geometric 3-dimensional figures. Here, there are 3 types of figures: cone, cylinder and sphere.</p>

The volume (V) of each figure can be calculated by the following formulas.

  • Cone: V = (1/3)πr2h
  • Cylinder: V = πr2h
  • Sphere: V = (4/3)πr3

Use the value π = 3.14159 in your calculation.

입력 형식

The first line of the input contains a positive integer n (1 ≤ n ≤ 100) which is the number of figures. The n following lines contain the description of each figure. In case of a cone, the line begins with letter C and followed by 2 values: r and h respectively. If it is a cylinder, the line begins with letter L and followed by 2 values: r and h respectively. If it is a sphere, the line begins with letter S and followed by only one value which is r.

출력 형식

Print out the max volume among the input figures with 3 decimal places

예제 입력

5
S 3.0
C 2.5 3
S 1.79
L 2.78 1.4
C 1.15 2.36

예제 출력

113.097

Comments

There are no comments at the moment.