|
|
вернуться в форумWhat is the solution for n = 10? What is the solution for n = 10? Re: What is the solution for n = 10? Послано aybek 16 дек 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.cppRe: What is the solution for n = 10? 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? Послано ASK 16 янв 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? Послано naik 10 июн 2014 02:29 Thanks!!! Java version: double res = N < 3 ? N : 1 / Math.sin(Math.PI / N) + 1; System.out.println(res); |
|
|