ENG  RUSTimus Online Judge
Online Judge
Задачи
Авторы
Соревнования
О системе
Часто задаваемые вопросы
Новости сайта
Форум
Ссылки
Архив задач
Отправить на проверку
Состояние проверки
Руководство
Регистрация
Исправить данные
Рейтинг авторов
Текущее соревнование
Расписание
Прошедшие соревнования
Правила
вернуться в форум

Обсуждение задачи 1984. Охранник компота

What is the solution for n = 10?
Послано Dmitriy99 16 дек 2013 20:07
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.cpp
Re: What is the solution for n = 10?
Послано Dmitriy99 16 дек 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?
Послано 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);