Блог пользователя Maverickk

Автор Maverickk, история, 9 лет назад, По-английски

Alice and Bob are playing a game called "Stone Game". Stone game is a two-player game. Let N be the total number of stones. In each turn, a player can remove 1, 2 or 3 stones. The player who picks the last stone, loses. They follow the "Ladies First" norm. Hence Alice is always the one to make the first move. Your task is to find out whether Alice can win, if both play the game optimally.

I/P: 2 //testcases 1 3

O/P: No Yes

As I am just getting started in dp,I cannot think how I would build a table and store values.can anyone give me a hint?Thank You.

Полный текст и комментарии »

Теги dp
  • Проголосовать: нравится
  • 0
  • Проголосовать: не нравится