网上说的很详细了,我再多说就有些矫情了,Nim游戏的另一变体:Lasker's Nim游戏,也是为数不多的可以直接应用规律解的Nim模型。
//HDU-3032.cpp
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <climits>
#include <cctype>
#include <algorithm>
#include <iostream>
#include <string>
#include <stack>
#include <map>
#include <set>
#include <queue>
#include <utility>
#include <vector>
#include <bitset>
#include <functional>
using namespace std;
//const double pai = acos(-1.0);
const double pai = 3.14159265358979323846;
const int INF = 0x3f3f3f3f;
typedef long long love_live;
int main(int argc, char const *argv[]) {
#ifndef ONLINE_JUDGE
// freopen("output", "w", stdout);
freopen("input", "r", stdin);
#endif
int n, m, i, j, k;
int t;
while(scanf("%d", &t) != EOF){
while(t--){
int ans = 0;
scanf("%d", &n);
for(i = 0; i < n; ++i){
scanf("%d", &k);
if(k % 4 == 3){
ans ^= (k + 1);
}
else if(k % 4 == 0){
ans ^= (k - 1);
}
else{
ans ^= k;
}
}
if(ans == 0){
printf("Bob\n");
}
else{
printf("Alice\n");
}
}
}
return 0;
}