码迷,mamicode.com
首页 > 其他好文 > 详细

hdu 1527

时间:2015-06-19 10:41:17      阅读:129      评论:0      收藏:0      [点我收藏+]

标签:模板   博弈   

题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1527
hint:威佐夫博弈
基本类似于模板

#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
using namespace std;
const double k=(sqrt(5.0)-1.0)/2.0;//常数

int main()
{
    int a,b;
    while(cin>>a>>b)
    {
        if(a>b)
            swap(a,b);
        int m=a*k;
        if(a!=(int)(m*(1+k)));
        m++;
        if(a + m == b)
            puts("0");
        else
            puts("1");
    }
    return 0;
}

hdu 1527

标签:模板   博弈   

原文地址:http://blog.csdn.net/qingshui23/article/details/46553369

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!