BZOJ 1299: [LLH邀请赛]巧克力棒 【SG函数/博弈分析/高斯消元】

因为太懒,放个博客
我只写了O(2n)O(2^n)

CODE

#include <cstdio>
int n, x[15];
int main () {
    for(int T = 1; T <= 10; ++T) {
        scanf("%d", &n);
        for(int i = 0; i < n; ++i) scanf("%d", &x[i]);
        bool flg = 0;
        for(int s = (1<<n)-1; s; --s) {//反着枚举,是为了.......................................................................................................................................................................................................................好玩
            int now = 0;
            for(int i = 0; i < n; ++i) if(s&(1<<i)) now ^= x[i];
            if(!now) { flg = 1; break; }
        }
        puts(flg ? "NO" : "YES");
    }
}
posted @ 2019-12-14 14:51  _Ark  阅读(83)  评论(0编辑  收藏  举报