zcmu-1918 G.这是个博弈(威佐夫博弈)

我的博弈分类总结链接

看下上面我的总结就知道了!其实套下公式就都在了,这几类博弈还是比较容易的。 

#include<cstdio>
#include <cstring>
#include<algorithm>
#include <iostream>
#include <cmath>
//#include <stdio.h>
#define ll long long
using namespace std;


int main()
{
    int a,b;
    while(cin>>a>>b){
        if(a == 0 && b == 0)
            break;
        if(a > b)
            swap(a,b);
        double x = (b - a) * ( 1 + sqrt(5)) / 2;
        if( a == (int)x)
            cout<<"X"<<endl;
        else
            cout<<"H"<<endl;
            
    }
    
    return 0;
}

猜你喜欢

转载自blog.csdn.net/hzyhfxt/article/details/82216498