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

Обсуждение задачи 1789. В поисках Додекаэдра

Hint
Послано Ibragim Atadjanov (Tashkent U of IT) 17 окт 2010 13:45
This problem seems hard but the algo is so simple.
if there n pedestals then the m is always 2 * n - 1;

if you just at i-pedestal and original is at jth, then
1. if abs(i - j) - even you can catch it if you just walk towards it just by one.
2. if abs(i - j) - odd then you just two times take the i-th pedestal to make the difference even and go to 1.

For doing above algo just start from the 1st pedestal to n
and take n again then go back to the 2nd pedestal

Good luck



Edited by author 17.10.2010 13:47
Re: Hint
Послано Mohan 25 сен 2014 12:58
You say m is always 2 * (n-1) or is it (2*n) - 1
whichever it is, your initial logic doesn't even satisfy the given output for n = 3.
By your above method m should either be 2 * (3-1) = 4 or (2*3) - 1 = 7 whichever formula you intended to say - none of them satisfy the given output i.e. for n = 3 , m = 2