ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Discussion of Problem 1984. Dummy Guy

What is the solution for n = 10?
Posted by Dmitriy99 16 Dec 2013 20:07
What is the solution for n = 10?
Re: What is the solution for n = 10?
Posted by aybek 16 Dec 2013 23:29
Dmitriy, remember that the sum of angles of regular polygon is 180(n-2),
where n is the number of it's angles.
The radius of circle is the half of polygon's diagonal + 1.0.
So the answer is 1.0/cos(pi*(n-2)/(2*n))+1.0, exceptions is 1, R will be 1.
And don't forget about precision it must be at least 6 digits.
If you still are having problems with it look at this:
https://github.com/oybek/timus/blob/master/1984.cpp
Re: What is the solution for n = 10?
Posted by Dmitriy99 16 Dec 2013 23:42
Thaks)

Edited by author 16.12.2013 23:45

Edited by author 16.12.2013 23:45
Re: What is the solution for n = 10?
Posted by ASK 16 Jan 2014 23:38
1/sin(M_PI/n)+1 (except 1 and 2), but the real problem with WA5 is that cout does not work while printf("%.7f\n", a) does.
Re: What is the solution for n = 10?
Posted by naik 10 Jun 2014 02:29
Thanks!!! Java version:
double res = N < 3 ? N : 1 / Math.sin(Math.PI / N) + 1;
System.out.println(res);