日韩av黄I国产麻豆传媒I国产91av视频在线观看I日韩一区二区三区在线看I美女国产在线I麻豆视频国产在线观看I成人黄色短片

歡迎訪問 生活随笔!

生活随笔

當(dāng)前位置: 首頁(yè) >

【BZOJ1022】小约翰的游戏(博弈论)

發(fā)布時(shí)間:2025/7/25 75 豆豆
生活随笔 收集整理的這篇文章主要介紹了 【BZOJ1022】小约翰的游戏(博弈论) 小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.

【BZOJ1022】小約翰的游戲(博弈論)

題面

BZOJ

題解

\(Anti-SG\)游戲的模板題目。

#include<iostream> #include<cstdio> #include<cstdlib> #include<cstring> #include<cmath> #include<algorithm> using namespace std; #define ll long long #define RG register inline int read() {RG int x=0,t=1;RG char ch=getchar();while((ch<'0'||ch>'9')&&ch!='-')ch=getchar();if(ch=='-')t=-1,ch=getchar();while(ch<='9'&&ch>='0')x=x*10+ch-48,ch=getchar();return x*t; } int n; bool check() {n=read();bool One=true;int X=0;for(int i=1;i<=n;++i){int x=read();if(x^1)One=false;X^=x;}if(One)return X==0;else return X; } int main() {int T=read();while(T--)check()?puts("John"):puts("Brother");return 0; }

轉(zhuǎn)載于:https://www.cnblogs.com/cjyyb/p/9489585.html

總結(jié)

以上是生活随笔為你收集整理的【BZOJ1022】小约翰的游戏(博弈论)的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯(cuò),歡迎將生活随笔推薦給好友。