-
Notifications
You must be signed in to change notification settings - Fork 0
/
C# code
34 lines (33 loc) · 929 Bytes
/
C# 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
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
//获得石子的堆数
int N = Convert.ToInt32(Console.ReadLine());
//获得每堆石子的个数
string[] str = Console.ReadLine().Split(' ');
int[] A = new int[N];
int XOR = Convert.ToInt32(str[0]);
for (int i = 1; i < N; i++)
{
A[i] = Convert.ToInt32(str[i]);
XOR = XOR ^ A[i]; //按位异或 判断是不是平衡状态,若是则后拿石子的player win
}
if (XOR == 0)
{
Console.Write("Bob");
}
else
{
Console.Write("Alice");
}
Console.ReadKey();
}
}
}