CPC '21 Contest 1 P3 - AQT and Circles

View as PDF

Points: 10 (partial)
Time limit: 2.0s
Python 4.0s
Memory limit: 256M

Author:
Problem types

AQT is studying circles and he has encountered the following problem. Two circles and have their centres located at on a coordinate plane. Circle and have radii and  , respectively. AQT decides to add another circle with radius  and a centre that is located at , where and are real numbers. The location of circle is random but it follows the condition that it is completely inside circle . Formally, . A position of circle is called valid if the circumference of circle has intersection points with the circumference of circle . AQT wants to know the probability that the position of circle is valid. AQT is given of these problems. Can you help AQT solve all of them?

Constraints   It is guaranteed that , , and are integers.   Input Specification

The first line contains , the number of problems you need to help AQT solve.

The next lines each contain the radii of the three circles: , , and .

Output Specification

Output lines. In the -th line, output the answer to the -th problem. Your answer will be considered correct if it differs from the correct answer by at most .

2
2 3 1
5 10 2

0.25
0.375

Explanation

For the first test case, circle and are represented by the blue circle and the red circle, respectively. The green circles represent possible valid positions for circle . This region represents the set of all possible centres for circle and has an area of  This region represents the set of all valid centres for circle and has an area of  The probability is 