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.

60 lines
1.5 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;
// 8个数字的用例
/*
1 8
1 5 6 7 9 12 14 17
:
i=1,a[8]-a[7]-1=2
i=3,a[6]-a[5]-1=2
i=5,a[4]-a[3]-1=0
i=7,a[2]-a[1]-1=3
Georgia will win
*/
const int N = 1010;
int a[N];
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=8
a[1~8] = {1 5 6 7 9 12 14 17}
a[8]-a[7]-1=17-14-1=2 1
a[7]-a[6]-1=14-12-1=1 2 ×
a[6]-a[5]-1=12- 9-1=2 3
a[5]-a[4]-1=9-7-1 =1 4 ×
a[4]-a[3]-1=7-6-1 =0 5
a[3]-a[2]-1=6-5-1 =0 6 ×
a[2]-a[1]-1=5-1-1 =3 7
1 3 5 7
2 2 0 3
*/
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;
}