PRISMSA - TRIANGULAR PRISM
In a far away nation, all the liquid substance are stored in a can of shape of a triangular prism. According to belief, this will bring security to their children. As they are very resource conservative people, unlike the earth natives, they want to use as less as possible amount of the raw material to be used for producing the can, which directly depends on the surface area of the can. Mr. Buzz Light Year, of Star Command, is provided with the responsiblity to find the minimal suface area required to prodce a can of a given volume.
Notes:
- Consider the material the can is made of to be infinitely thin.
- The base of the prism is equilateral triangle.
- Some formulas:
- a: triangle side's length.
- h: height of the prism.
- Volume, V = (a2 * sin(60°) * h)/2
- Surface Area, S = a2*sin(60°) + 3*a*h
- If not provided by a library, use the alue of 2*acos(0) for PI(π).
- Reminder:
- If your result is within 10-2 of the expected result, your solution will be evaluated as correct.
- If your result is between (1-10-2)*expected and (1+10-2)*expected, it will be evaluated as correct.
Constraints
Given volume will be an integer between 1 and 100000, inclusive.
Input
Input begins with a integer t, number of test cases. Then follows t lines, each one containing an integer, V, given volume.
Output
For each volume, print the minimum surface area required to produce the can in separate line.
Example
Input: 5 10 5 100 245 5421 Output: 30.3872837089 19.1427891970 141.0452767471 256.3318686611 2020.2796324002
Explanation for test case 1:
Volume = 10, a = 3.41995, h = 1.97451, Minimum Surface Area = 30.3872837089
hide comments
black_shroud:
2020-04-27 19:03:10
binary search!!!!0 sec sol |
|
rohit9934:
2017-03-11 18:54:36
Spelling of precision as **son cost me 1WA. Try at your own risk because ultimately you'll learn nothing except simple math which you have studied in high school.AC in 2nd Go. 0.00 s. |
|
taiken:
2017-02-02 22:00:15
Take into consideration the precision. Solution was right, but precision was set too low, so it gave WA. Set precision higher and AC. |
|
ROHIT Kumar:
2015-08-11 22:12:51
easy clas 12 level ....after this learned two new thing in c++ ...specially use of built in functions.. |
|
Daljeet Singh:
2015-03-23 21:11:40
very easy only 6 line of code Last edit: 2015-03-23 21:13:28 |
|
Alexandre Henrique Afonso Campos:
2014-03-11 03:03:52
I enjoyed very much solving this problem :) I filled one page with math equations. Coding was a detail. |
|
Anmol Pandey:
2014-01-18 10:18:49
Easy Problem completes my 50.. |
|
pika_pika:
2013-07-07 13:52:49
python nails it... AC in 1st attempt |
|
ওয়াসী (Wasi):
2013-05-29 16:57:38
Nice and easy!
|
|
Anirudh:
2013-02-18 17:42:53
Use double if getting stuck ! |
Added by: | abhiranjan |
Date: | 2011-02-18 |
Time limit: | 1s |
Source limit: | 50000B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Languages: | All |
Resource: | IIITM Local Contest |