Practice on Toph

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

Meena o Rajur Boring Class

By sajib_only · Limits 1s, 512 MB

One day, the teacher in Meena and Raju’s school was teaching the students about Fibonacci numbers. To make the class more interesting she show them this diagram:

The fibonacci diagram with squares and circular curve

The diagram was constructed by drawing squares whose lengths are fibonacci numbers. ( side of Nth square = Nth fibonacci number ) Then, a spiral curve was drawn over vertices. This curve is actually circular. In each square, a part of circle is drawn whose radius is the length of that square. The direction of the rotation of these circular curves are same so that they form a spiral curve together.

link The diagram after feeling up some region

But, Raju got bored of the lecture (as we all do sometimes) and started to fill up the outer region from the circle in each square (again, as we all do sometimes). The teacher saw it and punished him. She asked for the total area of the filled up region and told him that he cannot go home without answering her correctly. Help him find the correct answer.

You may assume that the value of pi is 3.141593.


First line of the input will be the number of test cases T ( 1<=T <= 100000 ). Then, for each case there will be a line containing the number of the sqares drawn on the diagram, N ( 1 <= N <= 35).


A single line per test case containing the area of the filled region (the region which is blue in the given diagram). Print the result with two digits after decimal point.





86% Solution Ratio

Pheonix98Earliest, Aug '17

ashik_jiddneyFastest, 0.0s

user.pn83d2w2Lightest, 0 B

abuhuraira071Shortest, 242B


Login to submit

Related Contests

Battle of Brains, 2017 Ended at 2017-08-12 08:10:00 +0000 UTC
Replay of Battle of Brains, 2017 Ended at 2017-08-14 19:00:00 +0000 UTC
Nepal Team Selection Contest 2 for ACM-ICPC Dhaka Regional 2017 Ended at 2017-10-05 18:15:00 +0000 UTC