首页 技术 正文
技术 2022年11月8日
0 收藏 444 点赞 1,858 浏览 1023 个字

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

winwin题目大意:有1到n个数字,两个人轮流选1个数。并把它的全部约数擦去。擦去最后一个数的人赢,输出先手必胜还是必败。解题思路:如果后手能赢。也就是说后手有必胜策略,使得先手第一次不管取哪个石子,后手都能获得最后的胜利。那么如今如果先手取1,接下来后手通过某种取法使自己进入必胜状态,可是,先手第1次取得时候就能够和后手这次取的一样,抢先进入必胜局面。于是除了0。其它都是必胜。代码:
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;
int main()
{
int n;
while(~scanf("%d",&n))
{
if(n==0)
printf("fail\n");
else
printf("win\n");
}
return 0;
}

相关推荐
python开发_常用的python模块及安装方法
adodb:我们领导推荐的数据库连接组件bsddb3:BerkeleyDB的连接组件Cheetah-1.0:我比较喜欢这个版本的cheeta…
日期:2022-11-24 点赞:878 阅读:9,104
Educational Codeforces Round 11 C. Hard Process 二分
C. Hard Process题目连接:http://www.codeforces.com/contest/660/problem/CDes…
日期:2022-11-24 点赞:807 阅读:5,581
下载Ubuntn 17.04 内核源代码
zengkefu@server1:/usr/src$ uname -aLinux server1 4.10.0-19-generic #21…
日期:2022-11-24 点赞:569 阅读:6,428
可用Active Desktop Calendar V7.86 注册码序列号
可用Active Desktop Calendar V7.86 注册码序列号Name: www.greendown.cn Code: &nb…
日期:2022-11-24 点赞:733 阅读:6,200
Android调用系统相机、自定义相机、处理大图片
Android调用系统相机和自定义相机实例本博文主要是介绍了android上使用相机进行拍照并显示的两种方式,并且由于涉及到要把拍到的照片显…
日期:2022-11-24 点赞:512 阅读:7,835
Struts的使用
一、Struts2的获取  Struts的官方网站为:http://struts.apache.org/  下载完Struts2的jar包,…
日期:2022-11-24 点赞:671 阅读:4,918