博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
[poj2234]Matces Game_博弈论
阅读量:4652 次
发布时间:2019-06-09

本文共 519 字,大约阅读时间需要 1 分钟。

Matches Game poj-2234

题目大意:n堆石子的Nim游戏,anti-SG。

注释:$1\le n\le 20$。


想法:用Colon定理即可。具体见:

最后,附上丑陋的代码... ...

#include 
#include
#include
#include
using namespace std;int main(){ int n; while(~scanf("%d",&n)) { bool flag=false; int ans=0; for(int i=1;i<=n;i++) { int x; scanf("%d",&x); ans^=x; if(x>1) flag=true; } printf("%s\n",((ans&&flag)||(!ans&&!flag))?"Yes":"No"); }}

小结:Nim游戏强强强。

转载于:https://www.cnblogs.com/ShuraK/p/9614871.html

你可能感兴趣的文章
GET请求在Tomcat中的传递及URI传递
查看>>
Far manager界面混乱问题解决
查看>>
Go数组和切片定义和初始化
查看>>
mysql 5.7 二进制安装方法
查看>>
JavaScript 复杂判断的更优雅写法借鉴
查看>>
<mvc:annotation-driven/>浅析
查看>>
ArcEngine开发之自定义工具
查看>>
SQL视频总结
查看>>
P4878 道路修建-美国
查看>>
dp练习
查看>>
vim
查看>>
maze_travel的隐私声明
查看>>
对正则表达式又重新学了一遍,笔记方便以后查阅
查看>>
UIKit应用 - Swift 版本: 3.让UITableViewCell的背景色渐变
查看>>
Java反射
查看>>
building tool
查看>>
JS中for循环输出三角形
查看>>
字节对齐2
查看>>
与Win8之磁盘活动时间100%斗争心得
查看>>
Matrix: android 中的Matrix (android.graphics.Matrix) (转)
查看>>