HYSBZ 2463

来源:互联网 发布:英雄联盟mac国服下载 编辑:程序博客网 时间:2024/06/05 09:47
J - 谁能赢呢?
Time Limit:10000MS    Memory Limit:131072KB    64bit IO Format:%lld & %llu
Submit Status Practice HYSBZ 2463

Description

小明和小红经常玩一个博弈游戏。给定一个n×n的棋盘,一个石头被放在棋盘的左上角。他们轮流移动石头。每一回合,选手只能把石头向上,下,左,右四个方向移动一格,并且要求移动到的格子之前不能被访问过。谁不能移动石头了就算输。假如小明先移动石头,而且两个选手都以最优策略走步,问最后谁能赢?

Input

    输入文件有多组数据。
    输入第一行包含一个整数n,表示棋盘的规模。
    当输入n为0时,表示输入结束。
 

Output

对于每组数据,如果小明最后能赢,则输出”Alice”, 否则输出”Bob”,每一组答案独占一行。

Sample Input

20

Sample Output

Alice代码:
#include<iostream>#include<cstdio>using namespace std;int main(){    int n;    while(~scanf("%d",&n)&&n)    {        if((n*n-1)%2==0)//偶数           printf("Bob\n");           else            printf("Alice\n");    }    return 0;}



#include<iostream>
#include<cstdio>
using namespace std;
int main()
{
    int n;
    while(~scanf("%d",&n)&&n)
    {
        if(n%2==1)
           printf("Bob\n");
           else
            printf("Alice\n");
    }
    return 0;
}


0 0
原创粉丝点击