UVa 10432 - Polygon Inside A Circle

Summary
Calculate the area of a polygon having equal sides inside a circle.

Explanation
The length of each side of the polygon are same. So if we add the n corners of the polygon to the center of the circle, then we get n triangles all having same area. Now the angle created at center by any triangle is exactly $$(2\pi / n)$$ and the length of both arms of triangle is r. So the area of any triangle is $$A = \frac{ r^2 \sin (\frac{2\pi}{n}) }{ 2 }$$. So, area of polygon is $$n A$$.

Input
2 2000 10 3000 5 100

Output
12.566 314.159 78.488

Solution

 * C++ : http://shipuahamed.blogspot.com/2012/09/uva-10432-polygon-inside-circle.html