Help Bob (141-zoj Monthly, July 2015)

Source: Internet
Author: User

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)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.