取石子游戏
来源:互联网 发布:天启秒杀软件 编辑:程序博客网 时间:2024/06/05 10:07
题目链接:http://poj.org/problem?id=1067
这是一道威佐夫博奕(Wythoff Game),具体分析参考http://www.cnblogs.com/celia01/archive/2011/11/15/2250171.html
我自己的代码如下:
#include<cstdio>#include<cmath>#include<algorithm>using namespace std;/************************************/void tt(int x, int y){ int t, d; if( x>y ) { t=x; /*判断是否为奇异局势*/ x=y; y=t; } d=(double)((y-x)*(sqrt(5.0)+1)/2); if(d==x) printf("0\n"); else printf("1\n");}/*************************************/int main(){ int a, b; while(~scanf("%d%d", &a, &b)) { tt(a, b); /*调用函数*/ } return 0;}
0 0
- "取石子"游戏
- 取石子游戏
- 取石子游戏
- 取石子游戏
- POJ1067取石子游戏
- PKU1067 取石子游戏
- 取石子游戏
- 取石子游戏
- 1067 取石子游戏
- PKU1067(取石子游戏)
- 1679 取石子游戏
- 1773 取石子游戏
- 取石子游戏
- POJ_取石子游戏
- 取石子游戏
- 2071 取石子游戏
- poj1067(取石子游戏)
- 取石子游戏
- Spring MVC 3 深入总结
- 实战Linux Bluetooth编程 (六) L2CAP编程实例
- 【Cocoa and Object-c : Up and Running 笔记】03 Simple C for Object-c
- JAVA设计模式 之 观察者模式
- #if 0 #end if
- 取石子游戏
- 技术路线的选择重要但不具有决定性
- cakephp: title
- 第四章 动作功能
- 实战Linux Bluetooth编程 (七) SDP协议
- linux操作命令:chmod修改文件权限
- 将局部变量的作用域最小化
- js date相关方法
- 基于注解的 Spring MVC 简单入门