POJ 2234 Matches Game 尼姆博弈
2015-04-17 17:32
375 查看
这道题是尼姆博弈的模板题,就是求几个数的异或。就状态过程中,会出现奇异局势,这几个数的异或若为0,这这种状态就是异或局势,异或局势就是说轮流取东西,最后取光者得胜,谁要是面对奇异局势,谁就会输,例如(0,0,0)。
代码如下:
代码如下:
#include<iostream> #include<cstdio> using namespace std; int main() { int n,a,s[25]; while(scanf("%d",&n)!=EOF) { for(int i=0; i<n; i++) cin>>s[i]; int i,val=s[0]; for(i=1; i<n; i++) val ^= s[i]; if(val) cout<<"Yes"<<endl; else cout<<"No"<<endl; } return 0; }
相关文章推荐
- poj--2234--Matches Game(尼姆博弈)
- POJ 2234 Matches Game (尼姆博弈)
- poj--2234--Matches Game(尼姆博弈)
- POJ 2234 Matches Game(尼姆博弈)
- POJ--2234 Matches Game(尼姆博弈)
- POJ-2234-Matches Game(尼姆博弈)
- POJ 2234 Matches Game 尼姆博弈
- POJ-2234 Matches Game(尼姆博弈)
- poj2234 Matches Game
- POJ 2234 Matches Game 博弈论
- POJ 2234 Matches Game(取火柴博弈1)
- POJ 2234 Matches Game (经典Nim博弈)
- POJ 2234 Matches Game 笔记
- poj 2234 Matches Game
- POJ 2234 Matches Game
- poj2234 Matches Game
- POJ 2234 Matches Game(博弈)
- POJ 2234 Matches Game(博弈论)
- poj2234——Matches Game
- poj-2234 Matches Game