Description
When I was on the machine last time, someone asked me, who is tt? Now I want to tell you that I haven't thought about it, so let's continue to call him TT.
In other words, TT is tired of the last stone game. This time, their game rules are as follows:
Two people take stones in turn, with a maximum of p and q each time. The number of remaining stones cannot be obtained (<p, p> = 1. Now the number of stones is N. If TT is used first, will he win? (TT and his roommates are both very smart)
Input
Input t + 1 line
Row 1st is an integer T, indicating that there are T groups of data below.
Row 2-T + 1, with three integers n, p, q in each row
Output
Output a row for each group of data. Determine whether or not TT will win as required.
The difference between this question and the previous question is that there are at most the minimum limit, and the final judgment criterion is that the person cannot get p at the end, the same as the above question at most and the sum, use the remainder of N and P + q for determination.
# Include <iostream> using namespace STD; int main () {int t; int N, P, Q; CIN> T; For (INT I = 0; I <t; I ++) {CIN> N> P> q; If (n <p) {cout <"lose" <Endl ;} else {If (N % (p + q)> = P) cout <"win" <Endl; elsecout <"lose" <Endl ;}} return 0 ;}