首页 > 其他 > 详细

hdu 1527 取石子游戏(Wythoff Game)

时间:2015-08-16 17:55:48      阅读:269      评论:0      收藏:0      [点我收藏+]

题意:Wythoff Game

思路:Wythoff Game

技术分享
#include<iostream>
#include<stdio.h>
#include<math.h>
using namespace std;

int main(){
    int a,b,t;
    double gr=(sqrt(5)+1)/2;//黄金比例 golden ratio
    double a2;
    while(~scanf("%d%d",&a,&b)){
        if(a>b){
            t=a;
            a=b;
            b=t;
        }
        a2=(b-a)*gr;
        if(a!=int(a2))printf("1\n");
        else printf("0\n");
    }
    return 0;
}
View Code

 

hdu 1527 取石子游戏(Wythoff Game)

原文:http://www.cnblogs.com/bofengyu/p/4734603.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!