Largest Volume

3.4

14 votes
Geometry, Ternary search, Medium, Algorithms, Approved
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 rradius of lower base and sslant 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 here enter image description here enter image description here

Input :

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

Output:

Largest Volume. Print 2 digits after floating point.

Constraints:

1 <= r, s <= 100

Time Limit: 1
Memory Limit: 64
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

?