- 题意:有k堆石子,每次选择一堆,在这堆中取至少一个石子,第一个无石子可取的人为输。
- 思路:经典游戏,直接有结论:如果这些堆的石子数为:a1,a2,a3…an.那么a1到an的异或为0,则先手有必败策略,否则先手有必胜策略。
###代码:
#include <set>
#include <map>
#include <cmath>
#include <stack>
#include <queue>
#include <string>
#include <vector>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
using namespace std;
typedef long long int LL;
const int M = 100009,INF = 0x3fffffff;
int main(void) {
int n;
while(cin >> n) {
int ans = 0;
for(int i = 0, j; i < n; i++) {
cin >> j;
ans ^= j;
}
if(!ans) cout << "Bob" << endl;
else cout << "Alice" << endl;
}
return 0;
}