NIM 游戏 acwing891

在这里插入图片描述
图片摘自 百度百科
博弈的范畴

#include <iostream>

using namespace std;

const int N = 100100;

int main()
{
    
    int n, t, ans = 0;cin >> n;
    scanf("%d", &t);
    ans = t;
    for(int i = 1; i < n ; i ++)
    {
        scanf("%d", &t);
        ans ^= t;
    }
    if(ans == 0) cout << "No" << endl;
    
    else cout << "Yes" << endl;
    return 0;
}
发布了53 篇原创文章 · 获赞 14 · 访问量 1906

猜你喜欢

转载自blog.csdn.net/weixin_45630535/article/details/104724163