Problem description Day met month, so there is Ming. When I met you, I became a companion.
That day, the sun and the moon meet, I see you. Moreover, the Earth has lost its brilliance, do you and I become a companion? This is destined to be a poignant story. (Above is nonsense)
Little T, like all worldly people, looks forward to the solar eclipse that is difficult to meet for a century. Stop the streets to see the sky, watching the sun and moon gradually approaching, small t's neck that acid ah (he insisted that this posture has been more than half an hour). He bowed his head up and looked around for four weeks. Suddenly found around standing a beautiful mm. Days gradually anxia, this mm in this street unexpectedly so dazzling, she is an angel? The angel standing beside little T.
Small T to mm exclaimed: "Fate na ~ ~". MM But no ambiguity: "Yes, 500 years a meet Oh!" (5000 words are omitted thereafter ...)
Small T hurriedly to mm to contact the way, can mm said: "I play a game with you, win, I will put my mobile phone number to tell you." "Little T, I thought the world which has the problem can be baffled me, then the mouthful promised down." MM began to say the rules of the game: "I have a pile of coins, a total of 7, from the pile of coins to take coins, at least 2 pieces at a time, up to 4, if the remaining less than 2 pieces will be taken out once." I'll take turns with you until the coins in the pile are taken, and the last one to take the coins is lost. I have played this game many times, let you, let you first take it ~ "
Small T pinch to count, no ah, this is impossible task. Small T show proud smile: "or mm priority, hehe ~" mm instantly stunned, think is the response to small T unexpectedly bar.
She is not angry: "Good boy, very clever, or so, you put my mailbox to me, I send you a text, each line has three numbers n,p,q, said a pile of coins have n, from this coin heap to take coins, a minimum of P, max Q, if the remaining less than P is to be taken out once." The two took turns, until the coins in the heap were taken, and the last one took the coins. For each line of three numbers, give the first person whether there is a winning strategy, if there is answer win, otherwise answer lost. You send me the corresponding answer, if you can send me the correct answer by 8 o'clock this evening, maybe we can see you tomorrow afternoon. ”
Small t without further ado, will own the mailbox to MM. When he hurried home, the internet to look at the mailbox, wow! MM e-Mail has arrived. He found that the text was up to 100000 lines long, with a large number of three digits in each line, but not more than 65536 integers. Small t look at the table is 6 o'clock in the afternoon, it is impossible to figure out all the results by hand. Can you help him and let him see the MM?
Input no more than 100000 lines, three positive integers per line n,p,q.
Output corresponds to each line of input, according to the rules of the game described above, to determine whether the first to win the strategy of the winner. Output win or lost.
Sample INPUT7 2 4 6 2 4
Sample Outputlostwin
Test instructions: not explained.
Solution: n= (p+q) *k+b; 0 <= B < p+q; the first person in the following is set to X, the second person is set to Y.
B=0: x First fetch Q, y take any w, X take q+p-w, finally must be left p to y take, so X win. (because Y is taken arbitrarily, so he can't win)
0<b<=p: X Take any w, y take p+q-w, and finally there must be a B to X, so y win.
B>p: X Take T (0<b-t<=p), y take any w, X take q+p-w, finally must be left b-t to y take, so X win.
1#include <cstdio>2#include <cstring>3#include <algorithm>4 using namespacestd;5 intMain ()6 {7 intn,p,q;8 while(~SCANF ("%d%d%d",&n,&p,&q))9 {Ten if(n% (p+q) = =0|| n% (P+Q) >p) Oneprintf"win\n"); A Elseprintf"lost\n"); - } -}
Hdu 2897 encounters Ming Xia