BZOJ原题链接

洛谷原题链接

完全不会呀。。
写了这题才知道\(SG\)函数原来也能打表找规律。。。
题解请看大佬的博客

#include<cstdio>
using namespace std;
inline int re()
{
	int x = 0;
	char c = getchar();
	bool p = 0;
	for (; c < '0' || c > '9'; c = getchar())
		p |= c == '-';
	for (; c >= '0' && c <= '9'; c = getchar())
		x = x * 10 + c - '0';
	return p ? -x : x;
}
int main()
{
	int t, n, x, y, s, k, an, i;
	t = re();
	while (t--)
	{
		n = re();
		for (an = 0, i = 1; i <= n; i += 2)
		{
			s = 0;
			x = re() - 1;
			y = re() - 1;
			k = x | y;
			for (; k & 1; k >>= 1, s++);
			an ^= s;
		}
		an ? printf("YES\n") : printf("NO\n");
	}
	return 0;
}

相关文章:

  • 2022-02-14
  • 2022-01-12
  • 2021-08-15
  • 2022-01-22
  • 2021-09-05
  • 2022-03-08
  • 2022-01-09
猜你喜欢
  • 2021-07-10
  • 2021-09-18
  • 2022-01-25
  • 2021-09-20
  • 2021-08-12
  • 2021-08-13
  • 2021-10-20
相关资源
相似解决方案