裸威佐夫博奕。证明见:http://blog.youkuaiyun.com/acm_cxlove/article/details/7854530。
代码如下:
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cstring>
using namespace std;
double eps = 1e-9;
int main()
{
#ifdef test
freopen("input.txt", "r", stdin);
#endif
int a, b;
while(scanf("%d%d", &a, &b) != EOF)
{
if(a > b)
swap(a, b);
double k = b - a;
int ans = k * (sqrt(5.0) + 1) / 2.0;
if(ans == a)
puts("0");
else
puts("1");
}
return 0;
}