首页 > 其他 > 详细

BZOJ1228或洛谷2148 [SDOI2009]E&D

时间:2018-10-26 15:25:49      阅读:178      评论:0      收藏:0      [点我收藏+]

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;
}

BZOJ1228或洛谷2148 [SDOI2009]E&D

原文:https://www.cnblogs.com/Iowa-Battleship/p/9856503.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!