Practice on Toph

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

Save the Hero

By battirunner · Limits 1s, 512 MB

One day Taskin just wake up and found himself in a very big circle. He is captured by The ICC. So ICC will cut or divide the circle in N+1 numbers of area by using N number of parallel lines where N is always an odd number. For simplicity, they draw the first line through the center of the circle which became its diameter D actually. The illustration is given in the following figure where N = 7.

So if you see the figure, it is clear that the distance between any two adjacent parallel lines are equal, or you can say width of every segment is equal like the circle in picture. It is also clear that how each part or segment in the circle is numbered. As upper segments from first line and lower segments are same, so for simplicity ICC numbered them with same serial number like both first upper and lower segments are given number ‘1’, then ‘2’ , ‘3’ and so on. So now ICC told Taskin in which number of segment or part of the circle he is captured in. If he can tell ICC the area of that particular segment correctly, ICC will let him go from their trap. Though Taskin is great at breaking the stumps with his pace, but he is confused now as he is not good at solving such problems.

Can you save our hero from ICC by writing a program that will compute the result of the area of that segment of the circle where Taskin is captured in?


First there is an input T ≤ 100 given which is the number of test cases .Then for each test case ICC gives you three positive integer inputs, which are N<=101 (where N is always odd), M ≤ (N+1)/2, which is the serial number of the segment Taskin is in and D ≤ 102, which is the diameter of the circle D. You have to compute the area of that particular segment.


Print the area of that particular segment. Output must be accurate up to two digits after the decimal point.


9 5 20	
9 4 20	
9 1 20



60% Solution Ratio

fsshakkhorEarliest, Oct '18

GeraltFastest, 0.0s

himel44Lightest, 0 B

mdvirusShortest, 248B


Login to submit

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