No.8 Don't Say N Game
タグ : / 解いたユーザー数 790
作問者 :
Problem Statement
You and Grant are playing the so-called "Don't Say 21 Game" (also known in some places as a stick-taking game).
You go first, but no matter how many times you play this game you keep losing, so you extend the rules:
Using natural numbers \(N\) and \(K\), consider the following game.
1. First, the first player is given \(0\).
2. From there, the player declares the given number plus one of \( [1,K] (1~K) \), trying not to declare a number that is \(N\) or greater (declaring such a number loses the game), and passes it to the opponent.
3. The players take turns repeating step 2. until the game is decided.
You start the game as the first player.
Assuming that both players move so as not to lose, given natural numbers \(N,K\),
return \(Win\) if you can win, and \(Lose\) otherwise.
Here, you will play the game \(P\) times, changing \(N,K\) each time.
Determine the result of each game.
(This is easy for those who know something along these lines, but those who don't may need some difficult reasoning.)
Input
\(P\) \(N_1\ K_1\) \(N_2\ K_2\) \(\dots\) \(N_P\ K_P\)
On line \(1\), an integer \(P\ (1 \leq P \leq 100) \) representing the number of games is given.
Each of the following \(P\) lines contains integers \(N\ (2 \leq N \leq 120000) \) and \(K\ (2 \leq K \leq 120000) \) representing the conditions of a game.
Output
Output P lines in total, with the result of each game as Win or Lose.
Print a newline at the end of each line.
Sample
Sample 1
Input
1 21 3
Output
Lose
This is the ordinary "Don't Say 21 Game".
If the second player chooses numbers well,
the first player always loses.
Sample 2
Input
1 12 5
Output
Win
If the first player chooses numbers well,
the first player can win.
Sample 3
Input
3 5 10 40 6 100 8
Output
Win Win Lose
\(3\) games are played with different conditions.
Note that \(N \leq K\) is also possible.
提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。