Download H - Game

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the work of artificial intelligence, which forms the content of this project

Document related concepts

Computer Go wikipedia, lookup

Artificial intelligence in video games wikipedia, lookup

Go (game) wikipedia, lookup

Transcript
Task H. Game
After the walk in the Zoo, Stancho was very late for the meeting of his department. All of the
members had had hundreds of milliliters of mineral water by the time Stancho finally arrived.
Because they had insufficient resources of mineral water Stancho was frightened that he could
not get enough mineral water. That is why he imposed a simple game in order to decide who
could drink more mineral water and who could not. Stancho was very important man and
nobody argued him. Any one who wanted more mineral water should play Stancho a single
game.
The game is played by two players. There are a given number of stones. Each of the players
can take some number of stones. The player that takes the last stone wins the game. Because it
was the 4th meeting of the department the players could take only powers of 4 stones in each
move (e.g. 1, 4, 16 ...). Stancho always starts first.
Stancho knew that if there are certain initial numbers of stones at the beginning of the game
he could always win the game. On the other hand he could not win the game for other initial
number of stones. Because there wasn’t much mineral water Stancho decided that he will
propose only initial numbers for which he could win the game. Your task is to write a
program that will determine whether Stancho could win the game if there is some number of
stones at the beginning of the game.
Input:
The first line of stdin contains a single integer indicating number of test cases. Each test case
consists of a single non negative on a separate line – the initial number of stones for this test
case (may be very large). The number of stones is reversed.
Output:
For each test case output on stdout: “Win” if Stancho can win the current game or “Lose”
otherwise.
Simple input:
Sample output:
3
0
1
2
Lose
Win
Lose