# Practice on Toph

Participate in exhilarating programming contests, solve unique algorithm and data structure challenges and be a part of an awesome community.

Participate in exhilarating programming contests, solve unique algorithm and data structure challenges and be a part of an awesome community.

W is working on the field from very beginning of the day. Now he has get tired and taking rest. At that time he started drawing at the ground.

Firstly he draws a circle. Then he draws two tangent from a point C(the two tangent touch the point D and E of the circle) and connects the two points with a line which are touched the circle. It created a chord named DE . Now he is thinking if he knows the shortest distance from the center to the chord AF and half length of DE, Can he find the area of CEBD portion? (B is a random point in DE arc)

After thinking a lot he find the solution. Can you also find a solution?

Input start with an integer T(1<=T<=100), denoting the number of test cases.

Then T lines containing two integers x(1<=x<=10000) and y(1<=y<=10000) where x denotes the length of AF and y denotes half length of DE.

For each case print the are of CEBD. Errors less than 10^{-6} will be ignored.

Input | Output |
---|---|

2 4 4 2 2 | 6.8672587713 1.7168146928 |

80% Solution Ratio

bisnu_sarkarEarliest,

bisnu_sarkarFastest, 0.0s

bisnu_sarkarLightest, 131 kB

steinumShortest, 124B

Login to submit

Key idea: Calculate the area of ADE and CDE triangle. Sum of the area of two triangles will be the a...