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

来源:互联网 发布:福利狗电视直播软件 编辑:程序博客网 时间:2024/05/29 17:19
#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;}
0 0
原创粉丝点击