POJ1067_取石子游戏_威佐夫博弈

/*
*State: 1067    Accepted    176K    16MS    C++    435B
*题目大意:
*        威佐夫博弈
*解题思路:
*        略。
*/
#include <iostream>
#include <stdio.h>
#include <cmath>
using namespace std;

int main(void)
{
    int big, small;
    while(scanf("%d %d", &big, &small) == 2)
    {
        if(big < small)
        {
            big = big ^ small;
            small = big ^ small;
            big = big ^ small;
        }
        double hj = (1.0 + sqrt(5.0)) / 2.0;
        int k = big - small;
        int tmp = k * hj;
        if(tmp == small)
            printf("0\n");
        else
            printf("1\n");
    }
    return 0;
}
原文地址:https://www.cnblogs.com/cchun/p/2610147.html