Who can win Luogu P4136 ?, Luogu p4136

Source: Internet
Author: User

Who can win Luogu P4136 ?, Luogu p4136
Description

Xiao Ming and Xiao Hong often play a game. Given an n × n board, a stone is placed in the upper left corner of the Board. They move stones in turn. In each round, a contestant can only move the stone up, down, left, and right to a grid, and cannot be accessed before moving it to the grid. No one can move the stone.

If James first moved the stone and both contestants took the best step, he asked who could win the game?

Input/Output Format

Input Format:

 

The input file contains multiple groups of data.

The first line contains an integer n, indicating the size of the Board.

If n is 0, the input is complete.

 

Output Format:

 

For each group of data, if James wins, the outputAliceOtherwise, outputBob, Each group of answers exclusive to one row.

 

Input and Output sample input sample #1: Copy
20
Output example #1: Copy
Alice
Description

For 20% of the data, ensure 1 <= n <= 10;

For 40% of the data, ensure 1 <= n <= 1000;

For all data, ensure 1 <= n <= 10000.

 

It seems to be the original question of the qingbei refresh course. I remember that 23333 was made in the test room.

It's just looking for a rule.

 

 

#include<cstdio>#include<cstring>#include<cmath>#include<algorithm>using namespace std;const int MAXN=1e5+10,mod=10007;inline char nc(){    static char buf[MAXN],*p1=buf,*p2=buf;    return p1==p2&&(p2=(p1=buf)+fread(buf,1,MAXN,stdin)),p1==p2?EOF:*p1++;}inline int read(){    char c=nc();int x=0,f=1;    while(c<'0'||c>'9'){if(c=='-')f=-1;c=nc();}    while(c>='0'&&c<='9'){x=x*10+c-'0';c=nc();}    return x*f;}int a[MAXN];int main(){    #ifdef WIN32    freopen("a.in","r",stdin);    #else    #endif    int N;    while(1)    {        N=read();        if(N==0) break;        if(N&1) printf("Bob\n");        else     printf("Alice\n");    }    return 0;}

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.