Game HDU-3389 Ladder game, just find the rules

According to the meaning of the title, select a few points, and the final figure is as follows: the

picture comes from here

  • According to the rule of the above figure, it is found that the points that have no degree are 1, 3, 4 1,3,41,3,4. In other words, all the stones will be classified into1, 3, 4 1,3,41,3,4 These three piles, it can be concluded that this is a ladder game. The nature of the ladder game can be approximated as the final result, some piles of stones cannot be removed, regardless of the number of piles.
  • According to the nature of the ladder game, 1, 3, 4 1,3,41,3,4 is regarded as point 0 in the ladder game, that is, the even pile, the rest of themod modmod 6 ! = 1 , 3 , 4 !=1,3,4 !=1,3,4 is an odd pile. Carry out the number of odd piles⊕ \oplus OK.
#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;
}

Guess you like

Origin blog.csdn.net/bloom_er/article/details/113774789