hdu1527威佐夫博奕(Wythoff Game)

简单的wythoff game 只需了解其奇异局势的公式:

ak=k*(sqrt(5)+1)/2  bk=ak+k;

#include<iostream>
#include<cmath>
const double tmp=((sqrt(5.0)+1)/2);
using namespace std;
int  main()
{
    int a,b;
    while(cin>>a>>b)
    {
        if(a>b)
        {
            a=b^a;
            b=a^b;
            a=b^a;
        }
        if(a==(int)(tmp*(b-a)))
            cout<<0<<endl;
        else cout<<1<<endl;
    }
    return 0;
}


 

原文地址:https://www.cnblogs.com/amourjun/p/5134168.html