hdu 1527
2015-06-18 22:27
423 查看
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1527
hint:威佐夫博弈
基本类似于模板
hint:威佐夫博弈
基本类似于模板
[code]#include <iostream> #include <cmath> #include <cstdio> using namespace std; const double q = (1 + sqrt(5.0)) / 2.0; // 黄金分割数 int Wythoff(int a, int b) { if (a > b) swap(a, b); int k = b - a; if (a == (int)(k * q)) return 0; // 奇异局面, 先手必败 return 1; } int main () { int a, b; while (scanf("%d%d", &a, &b) != EOF) { printf("%d\n", Wythoff(a, b)); } }
相关文章推荐
- 内存的静态分配和动态分配的区别
- 用PowerShell查找一个进程的父进程
- 位的与运算与取模
- mac上搭建python+selenium2的环境
- Spring REST 异常处理
- The Pilots Brothers' refrigerator - poj 2965
- connect to windows with rdp
- [leetCode] Combination Sum III
- 求和:1+11+111,或者2+22+……
- html做的word申请表(样式)
- Oracle启动em问题
- E3-1260L (8M Cache, 2.40 GHz) E3-1265L v2 (8M Cache, 2.50 GHz)
- 我总结的git命令指南。
- Dynamic Programming | Set 4 (Longest Common Subsequence)
- java通过JDBC链接SQLServer2012
- Android如何解决ANR
- 水仙花数
- Leetcode: Reorder List
- 冒泡排序
- [设计模式学习笔记]COMPOSITE组合模式