Description
One day, TT was bored in the dormitory, and he played a stone game with his colleagues. However, due to limited conditions, he/they used wangzi's steamed buns As stones. The rules of the game are as follows. There is a pile of stones, the number is n (1 <= n <= 109), two people take several of them in turn, each time a maximum of M (1 <= m <= 104), the first to win the stone. We know that TT and his/her roommates are both very smart. If TT is used first, will he/she win the game?
Input
The input contains less than 10000 groups of data. Each group contains one row of data. There are two numbers N and M, separated by spaces.
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)
Solution: This is a mathematical problem. You only need to find the rule. The judgment rule is the remainder of n divided by m + 1, but it does not prove.
# Include <iostream> using namespace STD; int main () {int A, B; while (CIN> A> B) {if (a % (B + 1 )! = 0) cout <"win" <Endl; else cout <"lose" <Endl ;}return 0 ;}