# PROBLEM LINK:

* Author:* Vasu Gamdha

# DIFFICULTY:

CAKEWALK, SIMPLE

# PREREQUISITES:

Basic Geometry, Thales’ Theorem

# PROBLEM:

The circle is having a radius of R. One of the diagonal of the inscribed quadrilateral is the diameter of the circle. You are also given the length of any one pair of opposite sides i.e. either AB and CD or AD and BC. Find the area of that inscribed quadrilateral.

# QUICK EXPLANATION:

An angle, subtended by two end points of a diameter to any point on circle, is always right angle.

With given two opposite sides given, calculate the individual areas of both right angled triangles. And sum of these right angled triangles is the area of inscribed quadrilateral.

# EXPLANATION:

According to the Thales’ Theorem, we can say that,

An angle subtended by two end points of a diameter to any point on circle, is always right angle.

So, considering the above figure, ΔABC and ΔADC are the right angled triangles, and ∠B and ∠D are right angles, respectively.

Now, As AC is the diameter,

∴AC=2 • R

And either AB and CD or AD and BC are given.

So, using Pythagoras’ Theorem, we can find other pair of sides.

AB^2+BC^2=AC^2 and AD^2+DC^2=AC^2

Now, we can find the area of right-angled triangle using,

ΔABC=\frac{1}{2} • AB • BC

ΔADC=\frac{1}{2} • AD • DC

And,

Area of Quadrilateral ABCD = Area of ΔADC + Area of ΔABC

# TIME COMPLEXITY:

**TIME:** O(1) per test-case

# SOLUTIONS:

## Setter's Solution

```
import math
t = int(input())
for _ in range(t):
r,s1,s2 = [int(x) for x in input().split(' ')]
s3=float(0.5)*s1*(math.sqrt(4*r*r - s1*s1))
s4=float(0.5)*s2*(math.sqrt(4*r*r - s2*s2))
print("%.2f" % (s3+s4))
```