Left Right
水题,nim博弈
#include<iostream> #include<algorithm> #include<cstdio> using namespace std; int main() { int T;scanf("%d", &T); for (int tcase = 1;tcase <= T;++tcase) { int ans = 0;int N;scanf("%d", &N); for (int i = 1, a, b;i <= N;++i) { scanf("%d %d", &a, &b); ans ^= (b - a - 1); }ans > 0 ? printf("Case %d: Alice\n", tcase) : printf("Case %d: Bob\n", tcase); } }
kuangbin刷题题单详解(博弈论) 文章被收录于专栏
题单:https://vjudge.net/article/371