Problem description:
Georigia and Bob 在玩一个游戏。
Input:
n = 3;
p = { 1, 2 , 3}
Output:
Bob wins
思路:将其看成一种Nim游戏。
Code:
int MAX_N = 1000; int N, P[MAX_N]; void solve(){ if(N%2==1) p[N++]=0; sort(P,P+N); int x=0; for(int i=0;i+1<N;i+=2) x^=(P[i+1]-P[i]-1); if(x==0) puts("Bob wins"); else puts("Georgia wins"); }
原文:https://www.cnblogs.com/astonc/p/9950035.html