Dp Problem

Правка en1, от Maverickk, 2015-07-28 13:48:50

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

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en1 Английский Maverickk 2015-07-28 13:48:50 582 Initial revision (published)