POJ.1067 取石子游戏 (博弈论 威佐夫博弈)

2023-04-23,,

POJ.1067 取石子游戏 (博弈论 威佐夫博弈)

题意分析

简单的威佐夫博弈

博弈论快速入门

代码总览

#include <cstdio>
#include <cmath>
#include <algorithm>
using namespace std; int main()
{
int n,m;
while(scanf("%d %d",&n,&m) != EOF){
if( n > m) swap(n,m);
double s = (sqrt(5) + 1) /2;
int t = floor( (m-n) * s );
if(t == n) printf("0\n");
else printf("1\n");
}
return 0;
}

POJ.1067 取石子游戏 (博弈论 威佐夫博弈)的相关教程结束。

《POJ.1067 取石子游戏 (博弈论 威佐夫博弈).doc》

下载本文的Word格式文档,以方便收藏与打印。