Practice on Toph

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

Dr. Tanzil's Island

By shajia · Limits 1s, 512 MB

Dr Tanzil has a circular shaped lake that he bought long ago. One day while he was visiting there, he found out with great surprise that, there has risen a round shaped island exactly from the center of the lake. He was very happy and considered the island as a gift from God. He decided to use the island for the welfare of people. So he decided to build a library that would be open for everyone.

Figure: The tangent touches the inner area at point DD.

As Dr Tanzil is very busy, he hired a developing company to build the library. To do that, first of all the developing company has to know the area of the island. But Dr Tanzil asked them not to measure the area of the island. Instead he asked the company to calculate the area of the remaining lake, from which the area of the island can later be calculated.

The only data available to complete this calculation is the length of slope that touches the side of the island at a point DD and touches the lake side at another point EE. For better understanding you can see figure 1. As the company has no geometry expert, they need your help to find out the area of the lake.


First line of the input contains an integer TT (1<T<10001 < T < 1000) which denotes the number of test cases. Then for each test case, there will be an integer LL (1<L<10001 < L < 1000) which denotes the length of the tangent.


For each input, output the area of the lake. You need to be precise up to 4 decimal places.





72% Solution Ratio

AashiqEarliest, Sep '19

c_sharpminorFastest, 0.0s

AashiqLightest, 131 kB

bokaifShortest, 45B


Login to submit

Toph uses cookies. By continuing you agree to our Cookie Policy.