Test instructions
Now there are the number of 1~n, each of which takes out a number, and all the factors of the number are taken out. The last person who can't take a number loses
Analysis:
1 is the factor of all numbers, all the first time any number 1 will be taken away; The following are two things:
Let's take 1 out first, for the other number
1, if the initiator will be defeated, then the first time to take 1, and then this will be defeated the state left to the opponent, then the initiator win
2, if the initiator win, then according to win the policy more can (1 as the incidental is removed)
#include <cstdio>int main () { int n; while (scanf ("%d", &n) ==1) { if (n==0) printf ("fail\n"); else printf ("win\n"); } return 0;}
Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.
Help Bob (141-zoj Monthly, July 2015)