POJ 1067佐威夫博弈

来源:互联网 发布:网络作家排行榜前十名 编辑:程序博客网 时间:2024/06/01 08:13

公式  当奇异局势:A=(B-A)*[(1+sqrt(5))/2] ,先手必败

#include"stdio.h"#include"math.h"#include"string.h"#include"iostream"using namespace std;double gold=(1+sqrt(5.0))/2.0;int main(){    int a,b;    while(scanf("%d%d",&a,&b)!=EOF)    {        if(a>b){int t=a;a=b;b=t;}        if(a==(int)((b-a)*gold))            puts("0");        else             puts("1");    }    return 0;}


0 0