【题目链接】
【思路要点】
- 补档博客,无题解。
【代码】
#include<bits/stdc++.h> using namespace std; #define MAXN 1005 int get(int x, int y) { if (x % 2 == 1 && y % 2 == 1) return 0; else return get((x + 1) / 2, (y + 1) / 2) + 1; } int main() { int T; scanf("%d", &T); while (T--) { int n, ans = 0; scanf("%d", &n); for (int i = 1; i <= n / 2; i++) { int x, y; scanf("%d%d", &x, &y); ans ^= get(x, y); } if (ans) printf("YES\n"); else printf("NO\n"); } return 0; } /* Use the program below to print a form of the sg function (try to replace the 4 with 1, 2, 8 ...) #include<bits/stdc++.h> using namespace std; #define MAXN 1005 int sg[MAXN][MAXN]; int mark[MAXN * MAXN]; int n, q, num; int main() { freopen("list.txt", "w", stdout); cin >> n; for (int s = 1; s <= 2 * n - 1; s++) for (int i = 1, j = s - 1; i <= n; i++, j--) { if (j > n || j <= 0) continue; num++; if (i != 1) { for (int k = 1; k < i; k++) mark[sg[k][i - k]] = num; } if (j != 1) { for (int k = 1; k < j; k++) mark[sg[k][j - k]] = num; } int ans = 0; while (mark[ans] == num) ans++; sg[i][j] = ans; } for (int i = 4; i <= n; i += 4) { for (int j = 4; j <= n; j += 4) printf("%4d", sg[i][j]); printf("\n"); } return 0; } */