HDU_1730 Northcott Game(博弈)
来源:互联网 发布:西瓜影音播放器mac版 编辑:程序博客网 时间:2024/06/06 02:48
题目请点我
题解:
这是一道变形的Nim博弈问题,将每次两棋子中间相差的格数当作一堆棋子,谁取走最后一个(留给对方一个必败态),谁就获胜。转换为了Nim问题,最后直接套公式就好了。
代码实现:
#include <iostream>#include <cstdio>#include <cstdlib>#include <cstring>#define MAX 1010using namespace std;int N,M;int sum;int res;int main(){ //freopen("in.txt","r",stdin); while( scanf("%d%d",&N,&M) != EOF ){ int a,b; res = 0; for( int i = 0; i < N; i++ ){ scanf("%d%d",&a,&b); res ^= abs(a-b)-1; } if( res == 0 ){ printf("BAD LUCK!\n"); } else{ printf("I WIN!\n"); } } return 0;}
0 0
- HDU_1730 Northcott Game(博弈)
- Northcott Game + nim博弈
- Northcott Game + 博弈 + nim博弈
- Northcott Game (Nim博弈)
- 杭电hdu 1730 Northcott Game 博弈
- Northcott Game(hdu1730变形的nim博弈)
- hdu 1730 Northcott Game (nim博弈变形)
- HDU 1730 Northcott Game(nim博弈)
- HDU 1730 - Northcott Game(博弈)
- HDU 1730 Northcott Game 【组合博弈】
- hdu 1730 Northcott Game Nim博弈~~
- HDOJ 1730 Northcott Game(nim博弈)
- hdu 1730 Northcott Game (Nim博弈)
- HDU 1730 Northcott Game (Nim博弈)
- HDU-1730-Northcott Game【nimm 博弈】
- Northcott Game
- Northcott Game
- HDOJ题目1730Northcott Game(sg博弈)
- spring(基础九) spring mvc 工作原理
- C#实现向已存在的Excel文件中写入数据实例(两种方法)
- 无法执行添加/移动操作,因为代码元素CConfigDlg是只读的
- 面向对象概述+类与对象的关系-第8天
- Xcode7下面用Unity3D的一些尴尬问题.
- HDU_1730 Northcott Game(博弈)
- POJ 3687 Labeling Balls(拓扑排序)
- kd树修改:BBF简析
- JAVA的StringBuffer类
- hdu 1548 A strange lift(bfs)
- 调试Makefile变量
- tcp三次握手的过程,accept发生在三次握手哪个阶段?
- hdu 动态规划学习目标
- VIM使用(保持更新)