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

BZOJ-2463

时间:2017-05-14 16:55:30      阅读:147      评论:0      收藏:0      [点我收藏+]

标签:棋盘   string   bbs   表示   不能   答案   space   code   inpu   

2463: [中山市选2009]谁能赢呢?

Time Limit: 10 Sec  Memory Limit: 128 MB
Submit: 2321  Solved: 1711
[Submit][Status][Discuss]

Description

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

Input

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

 

Output

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

Sample Input

2
0

Sample Output

Alice

HINT

 

对于所有的数据,保证1<=n<=10000。

 

 

/*
 * Author: lyucheng
 * Created Time:  2017年05月14日 星期日 15时53分23秒
 * File Name: BZOJ-2463.cpp
 */
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <time.h>
using namespace std;
int n;
int main(int argc, char* argv[])
{
     //freopen("in.txt","r",stdin);
    //freopen("out.txt","w",stdout;
    while(scanf("%d",&n)!=EOF&&n){
        if(n*n%2==1){
            puts("Bob");
        }else{
            puts("Alice");
        }
    }
    return 0;
}

 

BZOJ-2463

标签:棋盘   string   bbs   表示   不能   答案   space   code   inpu   

原文地址:http://www.cnblogs.com/wuwangchuxin0924/p/6852774.html

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