Submit | All submissions | Best solutions | Back to list |
VHELSING - Van Helsings gun |
In Transylvania, 1753, Dracula has returned from his long sleep, now, of course, someone needs to face it or humanity will be utterly destroyed by the evil bloodthirsty Dracula.
The only one with enough courage to face Dracula is Van Helsing. The only weapon that can defeat him is the silver gun, but Van Helsing does not know the exact amount of powder required for a deadly shot.
The magazine of gunpowder has the form given by intersection of three cylinders of radius r and infinite height, mutually orthogonal, and centered on the axes $X$, $Y$ and $Z$ in $R^3$, as shown below. Your task is to help Van Helsing calculate the exact amount of gunpowder that he will need, ie, the volume of the powder magazine.
Input
The first line of input contains an integer 1 ≤ T ≤ 100 representing the number of test cases. For each of the following
lines contain an integer 0 ≤ R ≤ 100, as shown above.
Output
For each case print one line containing the amount of gunpowder that Van Helsing needs, with 4 decimal places.
Example
Input: 2
0
1 Output: 0.0000
4.6863
Added by: | Paulo Costa |
Date: | 2012-01-16 |
Time limit: | 1s |
Source limit: | 50000B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Languages: | All except: ASM64 |
Resource: | IME/USP 2 - Brazilian ICPC Training Camp, Jan-Feb/2012 |
hide comments
|
||||||
2016-02-03 20:28:12
submit it in python very easy......only one math formula to finding volume of this intersection |
||||||
2015-08-19 22:45:18 shubham
use double instead of float. |
||||||
2015-07-26 13:10:10 ROHIT Kumar
read this for solving it http://mathworld.wolfram.com/SteinmetzSolid.html |
||||||
2015-06-01 16:33:33 Dushyant Singh
Just used direct formula. Don't know how to derive it. :-/ |
||||||
2014-12-20 22:25:57 HITESH GARG
Steinmetz solid ;) |
||||||
2014-10-14 15:01:05 jinkies
pretty easy |
||||||
2014-06-23 14:39:28 Samar Holkar
why gives wrong answer with floats???? |
||||||
2014-06-07 11:16:27 `Ak
Tricylinder easy one AC! in first go :) :) |
||||||
2014-05-18 17:03:17 shantanu
okay, so i'm getting every answer correct. still NZEC here. |
||||||
2013-12-02 18:33:40 Shanks
easy math..for the precesion problem 0.4lf will do :D |