POJ 2234 Matches Game(直接的NIM)
来源:互联网 发布:mac美国官网价格 编辑:程序博客网 时间:2024/05/16 23:37
//简单直接的博弈论问题,两个人分别取n堆石子,谁取到最后一颗谁赢,SG(x)=x,直接异或即可#include<stdio.h>#define maxn 20+10int m;long number[maxn];int find_sg(int x)//SG函数{ return x;}int main(){ while(scanf("%d",&m)!=EOF) { for(int i=1;i<=m;i++) scanf("%ld",&number[i]); int ans; if(m==1) ans=1; else { ans=find_sg(number[1])^find_sg(number[2]); for(int i=3;i<=m;i++) ans=ans^find_sg(number[i]); } if(ans==0)//若异或值为0,先手必败 printf("No\n"); else printf("Yes\n"); } return 0;}
- POJ 2234 Matches Game(直接的NIM)
- POJ 2234 Matches Game (经典Nim博弈)
- POJ 2234 Matches Game NIM曲石子游戏
- POJ Matches Game 2234【经典博弈Nim游戏】
- POJ 2234 Matches Game (nim博弈裸题)
- 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(Nim)
- poj 2234 Matches Game (博弈)
- [博弈]POJ 2234 Matches Game
- POJ 2234 Matches Game(博弈论)
- POJ 2234 Matches Game(博弈)
- C语言的变量与算术表达式
- 查找算法概述
- 黑马程序员-基础知识梳理6
- POJ 2484 A Funny Game(找规律)
- Oracle执行计划不走索引的原因总结
- POJ 2234 Matches Game(直接的NIM)
- VC++6.0调试篇:变量的观察--watch窗口的技巧(转)
- 百胜服装ERP分销端使用网络加密狗
- Oracle数据库rman环境配置详解
- Struts的html标签与普通html标签的区别之button
- 程序猿更需要有全局观的高度思考问题
- 单例设计模式
- SQL Server并发问题表分区解决方案
- Android事务 IMMEDIATE与EXCLUSIVE模式