N-polygon
Good mathematician, Rok Kralj has a lot of regular polygons. Each one of them looks something like this:
Image: Example
He decided to mark the distance between center point (A on picture) and one corner (B on picture) with r. He also marked number of edges with n.
Since he is running out of time, he is asking you to write a program which calculates perimeter and area of polygon for given n and r .
InputIn first line, there will be a natural number 3 <= n <= 100 000, and real number 0 < r <= 10 000, separated with single space.
OutputOutput two real numbers (rounded to 5 decimals) in two lines, first one should be the perimeter and second should be the area of the polygon.
Input:
Output:
8 1.5Output:
9.18440
6.36396Submit solution
Coming laterThe grading service will be connected in a later migration step. You can inspect the task and your previous results now.