zoukankan      html  css  js  c++  java
  • BZOJ-2463

    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;
    }
  • 相关阅读:
    k8s令牌登录设置方法
    etcd查看集群信息
    go Map
    go 切片重组
    go For-range结构
    go 切片
    go 数组与切片
    go 内存优化
    go 格式化输出
    go 闭包函数
  • 原文地址:https://www.cnblogs.com/wuwangchuxin0924/p/6852774.html
Copyright © 2011-2022 走看看