跳到正文

题解

题解:P17109 「FAOI-R13」巴巴博弈

lizihan15550390562约 1 分钟
原文
文章信息与版本

文章信息

收录
2026年7月20日
更新
2026年7月23日
篇幅
约 1 分钟
获赞
4
题目
P17109

版本

  1. v1当前

简单的巴什博弈。
不难看出,只要你原来一个奇数,每轮的最优方案就是两个人的改变的和是偶数,那么最后剩余的数距离 00 的长度正好是小于等于 ii 的奇数,一轮不满,所以先手必胜。
反之,偶数必败。

C++
#include<bits/stdc++.h>
#define int long long
using namespace std;
signed main(){
    ios::sync_with_stdio(false);
    cin.tie(0);//输入加速
    int n; std::cin>>n;
    while(n--){
        int y; std::cin>>y;
        cout<<(y%2==1?"Yes":"No")<<'\n';
    }
    return 0;
}
原文
存档评论1 条抓取于