Task DescriptionDiscussion (0)

Task :: N-polygon
Good mathematician, Rok Kralj has a lot of regular polygons. Each one of them looks something like this:

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 .
INPUT:
In first line, there will be a natural number 3 <= n <= 100 000, and real number 0 < r <= 10 000, separated with single space.
In first line, there will be a natural number 3 <= n <= 100 000, and real number 0 < r <= 10 000, separated with single space.
OUTPUT:
Output 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.
Output 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.5
Output:
9.18440
6.36396
6.36396
Submit Solution
Available Languages
Task info
Task Ratings
| Difficulty: | 3.6 (28 votes) |
| Quality: | 3.9 (23 votes) |
Acceptance Rate
Recent Submissions
Fastest Solutions
| User | Time |
|---|---|
| dejandenib | 0 s. |
| Gorgi... | 0 s. |
| nikola92 | 0 s. |
| syntax_error | 0 s. |
| palmeida | 0 s. |
| s-lime | 0 s. |
| tomislav | 0 s. |
| jevgeniy | 0 s. |
| Diabolic | 0 s. |
| Dgleich | 0 s. |
Solved By
Home
Training
Competitions
Forum
FAQ