POJ1067之威佐夫博弈
阿新 • • 發佈:2018-12-24
主要求出當前是不是奇異局勢就好啦~
要用到黃金分割~
程式碼:
#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
#include <cmath>
const int MAXN=10000;
using namespace std;
int main (void)
{
long long a,b;
double shu=(1 + sqrt(5.0))/2.0;
while(~scanf("%lld %lld",&a,&b))
{
if (a > b)
swap(a, b);
long long k = b - a;
if (a == (long long)(k * shu))
{
printf("0\n");
continue;
}
else
{
printf("1\n");
continue;
}
}
return 0;
}