Submit | All submissions | Best solutions | Back to list |
SQDIFF - Area Difference |
A gardener bought two sprinklers for his new garden. Each sprinkler moistens the soil around a circle with known radius. One will be working in the morning and the other in the evening. To plan how many plants of different species is better to plant, the gardener wants to know what area of the garden will be watered only in the morning, only in the evening or both in the morning and in the evening. After some searching on the Internet, he found a formula for calculating the area of intersection of circles, but for some reason the formula that would help to calculate the remaining two areas was not found.
Input
The first line contains T (1 <= T <= 1000) - the number of tests. The next T lines contain six integers x1, y1, r1, x2, y2 and r2 (0 <= xi, yi, ri <= 10000) - coordinates and radii of the first and second sprinkler, respectively.
Output
For each test case print the absolute value of the difference between the the area that is going to be watered only in the moring and the area that is going to be watered only in the evening rounded to two decimals after the point. Your score is the source length.
Example
Input: 1 2 2 4 5 2 3 Output: 21.99
Added by: | Spooky |
Date: | 2010-03-09 |
Time limit: | 3s |
Source limit: | 2000B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Languages: | All |
Resource: | Advancement Spring 2010, http://sevolymp.uuuq.com/, author: Alexey Shchepin |
hide comments
|
|||||
2015-05-23 20:38:14 Bhuvnesh Jain
Last edit: 2015-06-15 12:32:58 |
|||||
2015-01-25 16:17:27 jagdish chaudhary
what is the value of pi...in this question 22/7,or3.14or3.14159 please tell me |
|||||
2015-01-20 07:19:46 Varun Rajeev
i'm getting an error: Language available only on Cube Cluster. What do i do. I tried submitting in Python 2.7 and 3.4 and C. Last edit: 2015-01-07 06:16:46 |
|||||
2015-01-20 07:19:46 Mukund Kumar
@author:Have checked all cases of the intersection..though getting wa...need any of the test cases on which my soln fails..submission id:9228140 Thanks in advance No need to check for any cases ;) AC without that :P Last edit: 2013-05-11 05:03:17 |
|||||
2015-01-20 07:19:46 Shubham upadhaya
if 1st circle overlap other what is the output |
|||||
2015-01-20 07:19:46 triveni
"return 0;" is creating a lot of problems.. Any sugestion is welcomed . |
|||||
2015-01-20 07:19:46 Piotr KÄ…kol
And now the record is 47 in Bash by Nabb! :-) |
|||||
2015-01-20 07:19:46 Piotr KÄ…kol
Record of 59 chars was beaten by HWK on SHORTEN. :-) |
|||||
2015-01-20 07:19:46 Spooky
both 0 and 0.00 are acceptable |
|||||
2015-01-20 07:19:46 Purvesh Karkamkar
if the answer is 0 should it prined as 0.00 or 0.....im getting a WA for this quest....i believe im doin some error in outputing the values.... |