DMOPC '14 Contest 6 P1 - Core Drill

View as PDF

Submit solution


Points: 3 (partial)
Time limit: 2.0s
Memory limit: 64M

Author:
Problem type

Simon got a new drill recently. Everyone knows that a drill is shaped like a right circular cone. Simon knows his drill has radius r and height h. But now he wants to calculate the volume. Write a program to help Simon!

Input Specification

The first line of input will have an integer r (1 \le r \le 100).

The second line of input will have an integer h (1 \le h \le 100).

Output Specification

The first line of output should have the volume of Simon's drill. The output will be accepted if it's within an absolute or relative error of 10^{-2}.

Sample Input

3
5

Sample Output

47.12

Hint

V is the volume of the right circular cone with radius r and height h.

V=\dfrac{\pi r^2h}{3}


Comments


  • 1
    Galaxy_Kenneth  commented on Sept. 22, 2021, 2:06 p.m.

    You need to use the iomanip library if working in C++. Using 3.14 as pi is fine, just make sure to declare the variables in the order they appear otherwise DMOJ might interpret it as incorrect.


  • -4
    qiao_yun20060930  commented on Sept. 8, 2021, 12:30 p.m.

    This is just a simple formula which can be: double ans = (355/339) r r * h; and in c++ use cout << fixed << setprecision(3) << ans << "\n";


    • 4
      thomas__li  commented on Sept. 8, 2021, 1:21 p.m.

      no spoilers :blobhammer:


  • -2
    Lulu_likes  commented on Sept. 8, 2021, 7:39 a.m. edited

    PI = 3.141592653589793


  • 1
    SagarSaha  commented on July 3, 2020, 11:27 p.m.

    What is the value of π? I know it is 3.14159...

    but will i round it off to 3.14?


    • 3
      AlanL  commented on July 4, 2020, 12:06 p.m. edit 2

      If you read the output specification, it says in what cases your output will be accepted. In this case, it is fine to use 3.14 as π. If you have more questions, it would be easier to join the DMOJ Slack to get faster responses instead of commenting on each problem.

      Admin Edit: fixed to become reply :)