Maximize Volume

4.7

3 votes
Easy-Medium
Problem

Now our heroes - Maga and Alex are working for Oil Company as developers. Recently they have faced a great problem.

They couldn’t find the correct solution. Could you help them?

We are given r – radius of lower base and s – slant height. The figure can be cylinder or truncated cone. You have to find as largest volume as possible to carry oil respect to given information. The slant height is the shortest possible distance between the edges of two bases through surface of cone.

enter image description hereenter image description hereenter image description here

( This question is known to you but we want you to solve it. )

Input Format:

You are given 2 numbers. r– radius of lower base and s – slant height.

Output Format:

Largest Volume. Print 2 digits after floating point.

Constraints:

1 <= r, s <= 100

Sample Input
1 1
Sample Output
4.33
Time Limit: 5
Memory Limit: 256
Source Limit:
Explanation

In the sample test case, the answer is that it is truncated cone which the area of upper base is larger than the area of lower base. And then answer is simple 4.33.

Editor Image

?