Output
Output a row for each group of data. If the first TT can Win the game, "Win" is output; otherwise, "Lose" is output (no quotation marks are required)
Analysis: this is the famous Bash Gaem)
There are only one pile of n items, and two people take things from the pile of items in turn, each time at least one, a maximum of m. The final winner wins.
If (m + 1) | n, the first hand is defeated; otherwise, the first hand is defeated.
Obviously, if n = m + 1, a maximum of m items can be taken at a time. Therefore, no matter how many items are taken by the first accessor, the latter can take the remaining items at a time, the latter wins. therefore, we send
Now we know how to win: If n = (m + 1) r + s, (r is an arbitrary natural number, s ≤ m), the first accessors should take s items, if the latter takes k (≤ m ),
Take m + 1-K, the result of the remaining (m + 1) (r-1), after maintaining such a method, then the first accessors certainly win. in a word, you must keep the multiples of (m + 1) to the opponent to win the game.
#include <stdio.h>#include <stdlib.h>int main(){int Cases; int N,M; scanf("%d",&Cases); while(Cases--) {scanf("%d %d",&N,&M); if(N%(M+1)==0)printf("Lose\n"); elseprintf("Win\n");}return 0;}