hdu 2509 - Be the Winner(简单博弈)
来源:互联网 发布:软件代理销售合同 编辑:程序博客网 时间:2024/04/29 23:57
思路:
跟hdu1907一样的,都是尼姆博弈的裸应用,把每组苹果都看作一堆待取的物品,则一次只能从一个堆上取若干个(不少于1个).取最后一个苹果的人输掉。
唯一不同的地方是对于一个堆,某人取过以后可以变成两个堆,例如题目中所说的{@@@}--->{@ @};但这个并不影响结果,因为对于任意的T2状态不管怎么取,都是只能变作S1状态和S2状态。代码几乎和1907的一模一样。
代码如下:
int main(){ int n, x, cnt, ans = 0; while(~scanf("%d", &n)) { ans = 0; cnt = 0; for(int i = 0; i < n; ++i) { scanf("%d", &x); ans ^= x; cnt += (x>1); } if((ans==0&&cnt==0)||(ans!=0&&cnt==1)||(ans!=0&&cnt>=2)) puts("Yes"); else puts("No"); } return 0;}
- hdu 2509 - Be the Winner(简单博弈)
- HDU 2509 Be The Winner ( Nim 博弈 )
- hdu 2509 Be the Winner(博弈)
- [博弈]HDU 2509 Be the Winner
- hdu 2509 Be the Winner(博弈)
- hdu 2509 Be the Winner(博弈Nim)
- HDU 2509 Be the Winner nim博弈
- HDU 2509 Be the Winner (Nim博弈)
- hdu 2509 Be the Winner(博弈Nim)
- HDU 2509 Be the Winner Nim博弈
- HDU(2509) Be the Winner /HDU(1907) John (Nim 博弈)
- (step8.2.2)hdu 2509(Be the Winner——简单博弈)
- HDU 2509 Be the Winner 尼姆博弈
- HDU 2509 Be the Winner(尼姆博弈)
- Be the Winner HDU杭电2509 【尼姆博弈】
- HDU-2509-Be the Winner,博弈题~~水过~~
- HDU 2509 Be the Winner (尼姆博弈)
- Be the Winner HDU-2509【Nim经典博弈】
- Android中图片占用内存的计算
- oracle收集系统统计信息
- iOS7 (xCode5编译旧版本程序)获取到的iPhone5屏幕大小居然是320*480的问题
- VC2005从开发MFC ActiveX ocx控件到发布到.net网站的全部过程
- 通向架构师的道路(第二十三天)maven与ant的奇妙整合
- hdu 2509 - Be the Winner(简单博弈)
- 面向对象编程的六个基本原则
- CSS 子元素选择器
- CKFinder 2.0.2 去除 This is the demo version of CKFinder. Click here to visit our web site
- 通向架构师的道路(第二十四天)之Oracle性能调优-朝拜先知之旅
- hdu 4596 Yet another end of the world (一阶不定方程可解性 )
- sql 2005 清除日志 四舍五入
- 通向架构师的道路(第二十五天)SSH的单元测试与dbunit的整合
- Linux文件系统(一)-群居和一