其他分享
首页 > 其他分享> > Game HDU - 3389 阶梯博弈,找出规律即可

Game HDU - 3389 阶梯博弈,找出规律即可

作者:互联网

按照题目意思,选取几个点,最后得出的图如下:

图片来源于此

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef unsigned int uii;
typedef pair<int, ll> pii;
template<typename T>
inline void rd(T& x)
{
	int tmp = 1; char c = getchar(); x = 0;
	while (c > '9' || c < '0') { if (c == '-')tmp = -1; c = getchar(); }
	while (c >= '0' && c <= '9') { x = x * 10 + c - '0'; c = getchar(); }
	x *= tmp;
}
const int N = 2e5 + 10;
const int M = 1e7 + 10;
const int mod = 1e9 + 7;
const int inf = 0x3f3f3f3f;
int n, m, k;
bool a[6] = { 1,0,1,0,0,1 };
int main() {
#ifdef _DEBUG
	FILE* _INPUT = freopen("input.txt", "r", stdin);
	//	FILE* _OUTPUT = freopen("output.txt", "w", stdout);
#endif // !_DEBUG
	int cas = 0, T = 0;
	rd(T);
	while (T--) {
		//	while (~scanf("%d", &n)) {
		int n; rd(n);
		int ans = 0;
		for (int i = 1; i <= n; ++i) {
			int x; rd(x);
			if (a[i % 6]) ans ^= x;
		}
		printf("Case %d: ", ++cas);
		if (ans) puts("Alice");
		else puts("Bob");
	}
	return 0;
}

标签:HDU,const,int,typedef,long,3389,rd,Game,while
来源: https://blog.csdn.net/bloom_er/article/details/113774789