You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

58 lines
1.3 KiB

2 years ago
#include <iostream>
#include <string.h>
#include <stdio.h>
#include <vector>
#include <map>
#include <queue>
#include <algorithm>
#include <math.h>
#include <cstdio>
using namespace std;
const int N = 1010;
int a[N];
/*
1 7
5 6 7 9 12 14 17
i=1,a[7]-a[6]-1=2
i=3,a[5]-a[4]-1=2
i=5,a[3]-a[2]-1=0
i=7,a[1]-a[0]-1=4
Georgia will win
*/
int main() {
int T;
scanf("%d", &T);
while (T--) {
int n, s = 0;
scanf("%d", &n);
for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
sort(a + 1, a + n + 1);
/*
n=7
a[1~7] = {5 6 7 9 12 14 17}
a[7]-a[6]-1=2 1
a[6]-a[5]-1=1 2 ×
a[5]-a[4]-1=2 3
a[4]-a[3]-1=1 4 ×
a[3]-a[2]-1=0 5
a[2]-a[1]-1=0 6 ×
a[1]-a[0]-1=0 7
*/
for (int i = 1; i <= n; i += 2) //枚举 奇数阶台阶
{
s ^= a[n - i + 1] - a[n - i] - 1;
printf("i=%d,a[%d]-a[%d]-1=%d\n", i, n - i + 1, n - i, a[n - i + 1] - a[n - i] - 1);
}
//异或和为0先手必败否则先手必胜
puts(s == 0 ? "Bob will win" : "Georgia will win");
}
return 0;
}