BZOJ1022: [SHOI2008]小约翰的游戏John
来源:互联网 发布:mp3剪切合并软件 编辑:程序博客网 时间:2024/06/08 09:09
anti-Nim游戏
题目传送门
这道题和Nim游戏很像,但是条件反了过来:谁取走最后一个石子谁就输。于是就叫反Nim游戏。。。
当所有堆的石子数均为1且有偶数堆/至少有1堆石子数>1且石子数的异或和>0时,先手必胜。
代码:
#include<cstdio>#include<cstring>#include<algorithm>using namespace std;int t,n;int main(){ scanf("%d",&t); while (t--){ scanf("%d",&n); int t=0,x=0; bool flag=false; for (int i=1;i<=n;i++){ scanf("%d",&x); if (x>1) flag=true; t^=x; } if ((flag&&t)||(!flag&&!t)) printf("John\n"); else printf("Brother\n"); } return 0;}
阅读全文
1 0
- bzoj1022[SHOI2008]小约翰的游戏John
- bzoj1022 [SHOI2008]小约翰的游戏John
- bzoj1022: [SHOI2008]小约翰的游戏John
- bzoj1022: [SHOI2008]小约翰的游戏John
- bzoj1022 [SHOI2008]小约翰的游戏John
- BZOJ1022: [SHOI2008]小约翰的游戏John
- [BZOJ1022][SHOI2008]小约翰的游戏John-反NIM游戏
- bzoj1022: [SHOI2008]小约翰的游戏John 博弈
- 【bzoj1022】【SHOI2008】【小约翰的游戏John】【博弈论】
- 【BZOJ1022】[SHOI2008]小约翰的游戏John【Anti-Nim】
- 【bzoj1022】[SHOI2008]小约翰的游戏John 博弈论
- 【博弈论】bzoj1022[SHOI2008]小约翰的游戏John
- 12.7 bzoj1022 [SHOI2008]小约翰的游戏John
- 【Anti-Nim】BZOJ1022(SHOI2008)[小约翰的游戏John]题解
- BZOJ1022 [SHOI2008]小约翰的游戏John 【博弈论】
- BZOJ1022 [SHOI2008]小约翰的游戏John(Anti-Nim游戏)
- [BZOJ1022][SHOI2008]小约翰的游戏John(博弈Anti-Nim游戏)
- BZOJ1022(SHOI2008)[小约翰的游戏John]--博弈论(反Nim游戏)
- Java 通过反射原理取得entity的值
- UIBezierPath画曲线控制点的选取
- c++中map排序
- oracle initialization or shutdown in progress解决方法
- centos7.3下二进制安装mysql5.7.19记录
- BZOJ1022: [SHOI2008]小约翰的游戏John
- Python基础小笔记《2017-10-18》
- java面试题-java虚拟机(JVM)
- c++ string和其他类型互转
- tomcat对https配置
- [BZOJ1076]奖励关-状压+期望
- 全面理解Android中的Px,DPI,DIP,Density,Sp等概念
- 行人属性“Person Attribute Recognition with a Jointly-trained Holistic CNN Model”
- hbase集群搭建