ACC - A Complex Cone
A cone with radius of base 'r' and height 'h', is stretched to the left and right by length 'a' and 'b' respectively such that height of the stretched cones equal the height of the original cone and apexes of all the three cones are colinear.
Write a program to calculate the volume of the union of the two stretched cones (colored blue in image).
Input
The first line of input is the number of test cases T. (1 ≤ T ≤ 100)
For each test case, there is a single line containing 4 integers 'r', 'h', 'a' and 'b' respectively. (0 < r, h, a, b ≤ 10)
Output
Output a single line for each test case, containing the volume with 1 decimal place only. Answer should be correct to 1 decimal place without rounding off.
Example
Input: 2 1 1 1 1 10 10 10 10 Output: 1.4 1491.6
hide comments
Tomasz Rzepecki:
2021-10-04 23:09:27
Using <spoiler> resulted in NZEC. Thankfully, the maximum data is so small that I could just include a table of answers in the source. Frankly, it should not be that small, but oh well. Last edit: 2021-10-05 10:51:38 |
|
vlada_12345a:
2020-04-08 18:58:04
Can someone help me with the formula for the intersection, I am completely clueless
|
|
sanchit_aga:
2019-01-08 14:55:40
Does this problem require knowledge of integration? |
|
Cool Licznik:
2019-01-02 20:17:20
Nice problem - it was fun to solve. Thanks for posting. If anyone needs exact value for first example it is 4/9+pi/3. |
|
Yogendra Kumar:
2018-12-15 07:02:08
Thanks @cool_licznik for pointing it out! My sincere apologies to all for the trouble it might have caused! I just corrected the values in Example Output in the problem description. |
|
Cool Licznik:
2018-12-05 14:03:16
I've calculated it by three different methods, confirmed with visualizations and I'm convinced that the results should be about 21% higher (1491.642 for second case). Visualization:
|
Added by: | yogi |
Date: | 2018-11-10 |
Time limit: | 1s |
Source limit: | 50000B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Languages: | All |
Resource: | Own problem, Origin |