UVa 10432

From Algorithmist
Jump to navigation Jump to search

10432 - Polygon Inside A Circle[edit]

Summary[edit]

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

Explanation[edit]

The length of each side of the polygon are same. So if we add the n vertex 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 and the length of both arms of triangle is r. So the area of any triangle is . So, area of polygon is .

Notes[edit]

Please use

2 * acos (0)

(in C / C++) to calculate the value of pi. Otherwise precision error may occur.

Input[edit]

2 2000
10 3000
5 100

Output[edit]

12.566
314.159
78.488

Solution[edit]