【洛谷2252&HDU1527】取石子游戏(博弈论)

题面

HDU1527 取石子游戏php

洛谷2252 取石子游戏ios

题解

裸的威佐夫博弈spa

#include<iostream>
#include<cmath>
using namespace std;
const double phi=(sqrt(5)+1)/2;
int a,b;
int main()
{
    ios::sync_with_stdio(false);
    while(cin>>a>>b)
    {
        if(a>b)swap(a,b);
        int A=abs(a-b)*phi;
        if(A==a)cout<<0<<endl;
        else cout<<1<<endl;
    }
    return 0;
}
相关文章
相关标签/搜索