【BZOJ 1115】【POI 2009】石子游戏Kam

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;
}
上一篇:转:ActiveMQ的作用总结(应用场景及优势)


下一篇:linux之SQL语句简明教程---UNION ALL