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

Общий форум

prob 1087
Послано asif 24 мар 2001 17:55
What is meant by a perfect game?And,also please anyone give
me a clue for this problem.I used DP.But got Wrong answer.
                                              Asif.
Re: prob 1087 (by the way, there are specialized webboards for each of the problems)
Послано Ilya Semenov (NSU) 25 мар 2001 14:17
> What is meant by a perfect game?And,also please anyone
give
> me a clue for this problem.I used DP.But got Wrong answer.
>                                               Asif.


?????
it's one of the easiest problem here.
it took me 3 minutes to code & check, AC from the first try.

it's classical recursive deeping/dynamic programming.
lets consider a function "bool result(int N)" which
returns 'true' if current player would win having N stones,
and 'false' if he wouldn't.
so, if N==0, current player loses; otherwise he wins if
there exists at least one i such as other player (adversary
of the current player) loses with N-K_i stones.
(I omit various checkings, dynamic saving of resulsts,
etc.)

P.S. It surely can be solved only by dynamic programming
with no recursion at all, but I think the solution would be
somewhat more complicated.