`
阿尔萨斯
  • 浏览: 4186768 次
社区版块
存档分类
最新评论

hdu 1527 取石子游戏(组合游戏)

 
阅读更多

题目连接:hdu 1527 取石子游戏

题目大意:略。

解题思路:威佐夫博弈.

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

using namespace std;

int main () {
    int a, b;
    while (scanf("%d%d", &a, &b) == 2) {
        if (a > b)
            swap(a, b);
        int k = b - a;
        printf("%d\n", a == (int)(k * (1 + sqrt(5.0)) / 2) ? 0 : 1);
    }
    return 0;
}
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics