码迷,mamicode.com
首页 > 其他好文 > 详细

zoj博弈月赛

时间:2015-07-26 14:14:19      阅读:135      评论:0      收藏:0      [点我收藏+]

标签:

Help Bob

Time Limit: 2 Seconds      Memory Limit: 65536 KB

There is a game very popular in ZJU at present, Bob didn‘t meant to participate in it. But he decided to join it after discovering a lot of pretty girls playing it.

There are n stones on the ground and they are marked as 1 to n respectively. There will be 2 players in each competition. And the game rules are simple, A and B take turns to move. Each round, one of them can only take 1 number away, and then pick out all the divisors of the choosed number. When anyone who can not take away 1 number any longer, he will fail the whole game.

Input

There are multiple cases. Each case include an integer number n (0 ≤ n ≤ 100).

Output

For each case, A win, output "win". If not, output"fail".

Sample Input1

3
4

Sample Output1

win

win

#include<cstdio>
#include<algorithm>
using namespace std;
int main()
{
    int n;
    while(scanf("%d",&n)!=EOF)
    {
        if(n==0) printf("fail\n");
        else printf("win\n");
    }
    return 0;
}


版权声明:本文为博主原创文章,未经博主允许不得转载。

zoj博弈月赛

标签:

原文地址:http://blog.csdn.net/a197p/article/details/47067559

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!