题解 | 【模板】Nim游戏

【模板】Nim游戏

https://www.nowcoder.com/practice/8a43384a6a1c42eb9c7cbe47fb600db9?channelPut=tracker3

#include <bits/stdc++.h>
using namespace std;
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    int t;
    cin>>t;
    while(t--)
    {
        int x;
        cin>>x;
        long  long sum=0;
        for(long long i = 0;i<x;i++){
            long long n;
            cin>>n;
            sum^=n;
        }
        if(sum!=0){
            cout<<"YES"<<endl;
        }
        else cout<<"NO"<<endl;
    }
    return 0;
}

全部评论

相关推荐

评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务