# UVa 10772

## 10772 - Rose Windows[edit]

## Summary[edit]

A regular polygon with vertices ( is an even number) is inscribed in a circle of radius . Then every two vertices of the polygon are joined with straight lines, and the resulting regions are colored in different colors as shown in figures.

n=8 | n=12 |

Determine the area of the -th region. Regions are numbered from 1, starting from the innermost region.

## Explanation[edit]

If you study the figures carefully, you'll see that the boundary of every regions (except the outermost one) is a regular polygon with vertices, and its vertices are intersections of chords of the polygon.

More formally, let be the i-th vertex of the polygon: . And let be the number of region. Then the -th vertex of the boundary of -th region is the intersection of line segments and .

The area of -th region is the difference between inner areas of boundaries of -th and -st regions.

Area of regular polygon can be computed, if you know coordinates of its center O and one of vertices V. It equals

## Input[edit]

14 10 8 1 10 8 2 10 8 3 10 8 4 50 12 1 50 12 2 50 12 6 100 40 1 100 40 2 100 40 3 100 40 10 100 40 15 100 40 19 100 40 20

## Output[edit]

48.5281 117.1573 117.1573 31.3166 538.4758 1471.1432 353.9816 193.7897 576.5974 945.2074 2462.3319 1878.1616 576.5974 129.0335