UVa 10451

From Algorithmist

Jump to: navigation, search

Contents

[edit] 10451 - Ancient Village Sports

http://acm.uva.es/p/v104/10451.html

[edit] Summary

You are given the area of the polygon. You'll have to find area for spectators = area of the outer circle - area of the polygon area for officials = area of the polygon - area of the inner circle remember π = 2cos - 1(0) and your output should be rounded currect to 5 decimal points.

[edit] Explanation

Find the area of the small triangle made up the polygon (see UVa 10432) from there you can find the area of the outer circle and you can find the area of the inner circle through this formula:

a = area of the inner circle

A = Area of the polygon

N = number of sides


a = \frac{A}{ ( N \tan( \frac{\pi}{N} ) ) }
This is the square radious(r*r) of inner circle. Multiply it with PI, then it is the ares of the inner circle.
a = a * PI

[edit] Sample Input

3 0.43301
6 2.59808
9 6.18182
0 2.33333

[edit] Sample Output

Case 1: 0.61418 0.17121
Case 2: 0.54352 0.24188
Case 3: 0.53226 0.25314
Personal tools