# GEMCUT - Editorial

Author: Vasu Gamdha

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=2R

And either AB and CD or AD and BC are given.
So, using Pythagoras’ Theorem, we can find other pair of sides.

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

ΔABC=\frac{1}{2}ABBC

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))