Submit | All submissions | Best solutions | Back to list |
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
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 |
hide comments
|
|||||
2012-08-02 21:25:25 Jhoan Es Un Bruto
very easy, sure tutorial |
|||||
2012-06-25 11:23:44 Just Trying
Just simple maths aha :) |
|||||
2011-02-22 11:02:01 Bharath Sivaram
4 lines with python :-) |
|||||
2011-02-22 04:20:53 abhiranjan
@numerix :) |
|||||
2011-02-21 06:34:35 numerix
Could you please open it for more/all languages? Edit: Thanks for open it! Last edit: 2011-02-21 17:18:24 |