[bzoj Solution Notice Code

有一个n*n的棋盘,左上角有一个棋子。有两个人轮流移动棋子。若一个玩家无法移动则输。
每次都可以把棋子移动到它的上,下,左,右位置。求是先手必胜还是后手必胜。

Solution

如果n*n是奇数,则先手必胜,否则后手必胜。

Notice

没什么需要注意的。

Code

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45

#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
using namespace std;
#define sqz main
#define ll long long
#define rep(i, a, b) for (int i = (a); i <= (b); i++)
#define per(i, a, b) for (int i = (a); i >= (b); i--)
#define Rep(i, a, b) for (int i = (a); i < (b); i++)
#define travel(i, u) for (int i = head[u]; ~i; i = edge[i].next)

const ll INF = 1e9, Mo = 998244353;
const int N = 50000;
const double eps = 1e-6;
namespace slow_IO
{
ll ()
{
ll x = 0; int zf = 1; char ch = getchar();
while (ch != '-' && (ch < '0' || ch > '9')) ch = getchar();
if (ch == '-') zf = -1, ch = getchar();
while (ch >= '0' && ch <= '9') x = x * 10 + ch - '0', ch = getchar();
return x * zf;
}
void write(ll y)
{
if (y < 0) putchar('-'), y = -y;
if (y > 9) write(y / 10);
putchar(y % 10 + '0');
}
}
using namespace slow_IO;

int n;
int sqz()
{
while (~scanf("%d", &n) && n)
{
if (n & 1) puts("Bob");
else puts("Alice");
}
return 0;
}