You and your opponent are playing a game. The rule is that you start the game by saying a sequence of continuous integers. The sequence may have a length of 1, 2, or 3. The sequence should start from 1. So you could start the game by saying either {1}, or {1,2}, or {1,2,3}. Your opponent will follow your sequence by saying his sequence of length 1, 2, or 3. His sequence starts from where you stop. E.g. if you say {1,2}, then you opponent may say either {3}, or {3,4}, or {3,4,5}; and you follow your opponent's sequence in the same manner. The game continues until one person says 30 in his sequence and that person wins. The problem asks you to design a strategy so that you will win (i.e. you are the first to be able to say 30 in your sequence).
The first player should start with {1,2}.
For the second player's next six moves, the first player should respond with a sequence of length:
3 if the second player's sequence was of length 1
2 if the second player's sequence was of length 2
1 if the second player's sequence was of length 3
At the end of this sequence of moves, the first player's last move will be {26} or {25,26} or {24,25,26} because 2 + 6 x 4 = 26.
At that point, it will be the second player's turn to make a move, who will be able to play {27} or {27,28} or {27,28,29}.
The first player can then win by responding with {28,29,30} or {29,30} or {30}.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment