HDOJ-1527 取石子游戏(威佐夫博奕)

#include <iostream>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <vector>
#include <cstdio>

using namespace std;

int main(){

    //freopen("in.txt", "r", stdin);
    int a, b;

    while(cin >> a >> b){

        if(a > b)
          swap(a, b);
        int d = (b - a) * ((sqrt(5) + 1) / 2.0);
        if(d == a)
          cout << 0 << endl;
        else
          cout << 1 << endl;
    }

    return 0;
}

你可能感兴趣的:(HDOJ-1527 取石子游戏(威佐夫博奕))