题解 | 【模板】Nim游戏

【模板】Nim游戏

https://www.nowcoder.com/practice/8a43384a6a1c42eb9c7cbe47fb600db9

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

全部评论

相关推荐

牛客93169152...:可以发邮件,我停了三天没收到链接,发邮件问了一下,十分钟后就有了
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

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