http://www.lydsy.com/JudgeOnline/problem.php?id=1115
差分后变成阶梯博弈。
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
const int N = 1003;
int a[N], n, s;
int main() {
int T; scanf("%d", &T);
while (T--) {
scanf("%d", &n);
for (int i = 1; i <= n; ++i) scanf("%d", a + i);
s = 0;
for (int i = n; i >= 1; i -= 2) s ^= a[i] - a[i - 1];
puts(s ? "TAK" : "NIE");
}
return 0;
}