poj2234 Matches Game博弈论
来源:互联网 发布:post请求返回json数据 编辑:程序博客网 时间:2024/05/16 09:29
题意:有M堆石子,每堆石子的数量已知,有两个玩家,轮流从这些石子中选取某一堆从中拿走若干个,至少拿一个,也可以全拿走,问先手能否取胜
最基本的Nim博弈,直接异或运算
#include<cstdio>#include<iostream>using namespace std;int main(){int n,a[25];while(cin>>n){ for(int i=1;i<=n;i++) cin>>a[i]; int x=a[1]; for(int i=2;i<=n;i++) x=x^a[i]; if(x!=0) cout<<"Yes"<<endl; else cout<<"No"<<endl;}}
1 0
- poj2234 Matches Game博弈论
- [poj2234]Matches Game
- poj2234 Matches Game
- poj2234 Matches Game
- POJ2234:Matches Game(Nim)
- 【poj2234】Matches Game
- poj2234 Matches Game
- 【poj2234】 Matches Game
- poj2234——Matches Game
- [poj2234]Matches Game nim游戏
- poj2234(Matches Game 尼姆博弈)
- POJ 2234 Matches Game(博弈论)
- POJ 2234 Matches Game 博弈论
- POJ 2234 Matches Game(博弈论)
- POJ-2234:Matches Game(博弈论,异或大法好)
- Matches Game
- 博弈论---Game!
- POJ2234
- OC中的self和super
- 给Eclipse提速的7个技巧
- caffe bug notes
- java之happen before relationship 学习篇
- Nodejs异步回调的优雅处理方法
- poj2234 Matches Game博弈论
- Unity&Shader基础篇-绘制网格+圆盘
- docker删除images
- HDU 5586 Sum (最大连续子段和)
- IntelliJ IDEA导航特性Top20
- 文章标题
- 字符串相关知识
- 解决Python自带的json序列化工具不能序列化datetime类型数据问题
- 61. Rotate List