Problem Statement | |||||||||||||
This problem contains an image.
TopCan, Inc. is a major producer of food. It produces all kinds of food than can be filled into a can: pineapples, mushrooms, peas, etc. However, business is not going well, so they are looking for ways to make production cheaper. An important expense factor is the amount of material needed for producing the can, which directly depends on the surface area of the can. Currently, cans are produced in all imaginable shapes and sizes, but to reduce cost, the company thinks about producing only cans in the shape of a cylinder (as shown below). So to be able to decide whether production should be changed TopCan wants to know, for a given volume, the minimal surface area possible of such a can. As the company's brightest employee, this task has been assigned to you. Given an int volume, return a double, the minimal surface area possible of a cylinder that has the given volume. | |||||||||||||
Definition | |||||||||||||
| |||||||||||||
Notes | |||||||||||||
- | Consider the material the can is made of to be infinitely thin. | ||||||||||||
- | Some formulas for your convenience: r: radius of the circle being the base of the cylinder h: height of the cylinder Volume V = h * PI * r2 Surface S = 2 * PI * r * (r + h) | ||||||||||||
- | If not provided by a library, use the value of 2*acos(0) for PI. | ||||||||||||
- | Reminder: If your result is within 10-9 of the expected result, your solution will be evaluated as correct. If your result is between (1+10-9)*expected and (1-10-9)*expected, it will be evaluated as correct. | ||||||||||||
Constraints | |||||||||||||
- | volume will be between 1 and 100000, inclusive. | ||||||||||||
Examples | |||||||||||||
0) | |||||||||||||
| |||||||||||||
1) | |||||||||||||
|