hdu 1527

地址:http://acm.hdu.edu.cn/showproblem.php?pid=1527

题意:中文。

mark:经典博弈,传说中的Wythoff’s Game。论文在此:http://scimath.unl.edu/MIM/files/MATExamFiles/Cotton_MATpaper_Final_EDITED.pdf

值得一提的是论文里提到的神奇的贝蒂定理(Beatty Theorem):若a和b都是无理数且1/a + 1/b == 1,则{[a],[2a],[3a]...}和{[b],[2b],[3b]...}这两个集合没有相同元素且他们的并组成正整数集。([x]表示对x下取整。)

代码:

 1 # include <stdio.h>
 2 # include <math.h>
 3 
 4 
 5 int main ()
 6 {
 7     double d, GRatio = 0.5*(sqrt(5)+1) ;
 8     int a, b, t ;
 9     while (~scanf ("%d%d", &a, &b))
10     {
11         if (a > b) t = a, a = b, b = t ;
12         d = GRatio * (b-a) ;
13         if ((int)d != a) puts ("1") ;
14         else puts ("0") ;
15     }
16     return 0 ;
17 }
原文地址:https://www.cnblogs.com/lzsz1212/p/3304692.html