题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1527
hint:威佐夫博弈
基本类似于模板
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
using namespace std;
const double k=(sqrt(5.0)-1.0)/2.0;//常数
int main()
{
int a,b;
while(cin>>a>>b)
{
if(a>b)
swap(a,b);
int m=a*k;
if(a!=(int)(m*(1+k)));
m++;
if(a + m == b)
puts("0");
else
puts("1");
}
return 0;
}
原文地址:http://blog.csdn.net/qingshui23/article/details/46553369