首页 > 代码库 > BZOJ1228 [SDOI2009]E&D

BZOJ1228 [SDOI2009]E&D

蒟蒻不会= =

话说写题解的巨巨也只会打表233

反正先A掉再说

 

 1 /************************************************************** 2     Problem: 1228 3     User: rausen 4     Language: C++ 5     Result: Accepted 6     Time:184 ms 7     Memory:804 kb 8 ****************************************************************/ 9  10 #include <cstdio>11  12 using namespace std;13  14 int n, SG;15  16 inline int read() {17     int x = 0;18     char ch = getchar();19     while (ch < 0 || 9 < ch)20         ch = getchar();21     while (0 <= ch && ch <= 9) {22         x = x * 10 + ch - 0;23         ch = getchar();24     }25     return x;26 }27  28 inline int work(int x, int y) {29     int t = 1 << 30, i, res = 31;30     for (i = 30; i; --i, t >>= 1)31         if (x <= t && y <= t) res = i;32         else {33             x -= x > t ? t : 0;34             y -= y > t ? t : 0;35         }36     return x == 1 && y == 1 ? 0 : res;37 }38  39 int main() {40     int T = read(), i, x, y;41     while (T--) {42         n = read(), SG = 0;43         for (i = 1, n >>= 1; i <= n; ++i) {44             x = read(), y = read();45             SG ^= work(x, y);46         }47         if (SG) puts("YES");48         else puts("NO");49     }50     return 0;51 }
View Code

 

BZOJ1228 [SDOI2009]E&D