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;}