player can remove 1 or X or Y coins from the tower

Jul 26, 2018 at 8:53pm
A and B are playing a new game today . They form a tower of N coins and make a move in alternate turns . B being the God plays first . In one move player can remove 1 or X or Y coins from the tower . The person to make the last move wins the Game . Can you find out who wins the game ?

actually what I tried with recursion is tsking a bit longe ..... can any one suggest ,e witth dp soln of it


Jul 26, 2018 at 9:30pm
B being the God plays first
I feel A is at a bit of a disadvantage here. Does A get smitten if they win?

In one move player can remove 1 or X or Y coins from the tower
What does this mean? What are X and Y?
Jul 27, 2018 at 9:12am
Can you find out who wins the game ?


For some input values, either one could win the game. If X=2 and Y=3, for example, either one of them could win the game. Is this the whole question?
Jul 27, 2018 at 11:07am
The first player always win the game. He left 1 + n * max(1, X, Y) coins at the tower. The second has no chance to win. You need O(1) to solve this.
Jul 27, 2018 at 11:12am
Oh, do we assume the players are perfectly rational and don't make mistakes? That sure does change things.
Topic archived. No new replies allowed.