Xiao Xin's love story time limit:1000ms Memory limit:65536k have doubts. Point here ^_^ topic description After unremitting efforts, Xiao Xin finally chased the goddess mm, one day the goddess to test the IQ of Xiao Xin, and Xiao Xin played a game. They took out n stones and put them in a column. The game, each time only from the left a row of stones at the beginning, take one or two stones, the goddess let Xiao Xin take first. When the last one is finished, there is no stone even if he wins the game. Xiao Xin don't want to lose face in front of the goddess, so he asked you to help him in advance to calculate whether you can win, if you can win the output "you win" otherwise output "you lose". We think Xiao Xin and her goddess are smart enough. Each decision is the most reasonable. Enter a positive integer n (1 <= n <= 300). Output if Xiao Xin can win output "you win", otherwise output "you lose" sample input
1
7
Sample output
You win your
win
Hint This problem we can think so, if the beginning only 1 or 2 stones, then Xiao Xin win, if the beginning is 3 stones, no matter how small Xin how to take, will be defeated. If the first is 4 or 5 stones, so small Xin first Take 1 or 2 stones, regardless of the goddess take a few stones, Xiao Xin will win, so we can find the law, that is, when the number of stones as a multiple of 3, small Xin will be defeated, other times Xiao Xin will win. This is a typical game theory problem, you can study it if you are interested.
Code
#include <cstdio>
int main ()
{
int n;
while (~SCANF ("%d", &n))
{
if (n%3==0)
printf ("You lose\n");
else
printf ("You win\n");
}
return 0;
}