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

Обсуждение задачи 1020. Ниточка

saba ac program [2] // Задача 1020. Ниточка 3 июн 2007 15:17
var n,i:integer;
r:extended;
a:array[1..100] of record x,y:extended; end;
res:extended;
begin
read(n); read(r); res:=0;
for i:=1 to n do Readln(a[i].x,a[i].y);
for i:=2 to n do res:=res+sqrt(sqr(a[i].x-a[i-1].x)+sqr(a[i].y-a[i-
1].y));
res:=res+sqrt(sqr(a[n].x-a[1].x)+sqr(a[n].y-a[1].y));
res:=res+2*pi*r;
writeln(res:0:2);
end
daftcoder [Yaroslavl SU] Re: ac program [1] // Задача 1020. Ниточка 8 июл 2007 03:59
Tell me plz, why res:=res+2*pi*r ?

Why not res:=res+(n-2)*pi*r for n>2

(n-2)*pi is a summ if angles
espr1t Re: ac program // Задача 1020. Ниточка 8 июл 2007 20:35
With equal radii of the circles it is sufficient to add one circle size to the result (which is calculated as if we have dots instead of circles). It is easy provable so I will leave that to you. If we had circles with overlapping it would be much harder, however we don't so it works =)


Edited by author 08.07.2007 20:37