POJ 1067 取石子游戏 经典威佐夫博弈
2017-08-07 11:34
429 查看
这里说的很详细:http://blog.csdn.net/y990041769/article/details/21694007
#include<iostream>
#include<algorithm>
#include<queue>
#include<vector>
#include<string>
#include<cstring>
#include<cstdio>
#include<cmath>
typedef long long LL;
using namespace std;
LL a,b,c; //c为差值
int main()
{
// freopen("E:\\ACM\\test.txt","r",stdin);
double d=(sqrt(5)+1)/2.0; //威佐夫博弈1.618
// printf("%.10f\n",d);
while(cin>>a>>b)
{
if(a<b) swap(a,b);
c=(a-b)*d;
if(c==min(a,b)) puts("0");
else puts("1");
}
return 0;
}
#include<iostream>
#include<algorithm>
#include<queue>
#include<vector>
#include<string>
#include<cstring>
#include<cstdio>
#include<cmath>
typedef long long LL;
using namespace std;
LL a,b,c; //c为差值
int main()
{
// freopen("E:\\ACM\\test.txt","r",stdin);
double d=(sqrt(5)+1)/2.0; //威佐夫博弈1.618
// printf("%.10f\n",d);
while(cin>>a>>b)
{
if(a<b) swap(a,b);
c=(a-b)*d;
if(c==min(a,b)) puts("0");
else puts("1");
}
return 0;
}
相关文章推荐
- poj1067 hdu1527 取石子游戏 威佐夫博弈
- poj 1067 取石子游戏(威佐夫博弈)
- POJ 1067 取石子游戏(威佐夫博弈)
- poj1067 威佐夫博弈模板 取石子游戏
- POJ 1067 取石子游戏 (威佐夫博弈)
- poj 1067 取石子游戏(威佐夫博弈)
- POJ 1067 取石子游戏 (巴什博弈+威佐夫博弈)
- [POJ 1067]取石子游戏(威佐夫博弈)
- poj 1067 取石子游戏(威佐夫博弈)
- [POJ 1067] 取石子游戏 威佐夫博弈
- POJ1067_取石子游戏_威佐夫博弈
- POJ-1067取石子游戏,威佐夫博弈范例题/NYOJ-161,主要在于这个黄金公式~~
- poj 1067 取石子游戏(威佐夫博弈模板)
- poj 1067 取石子游戏 (威佐夫博弈)
- POJ-1067 取石子游戏(威佐夫博弈)
- poj 1067 取石子游戏(威佐夫博弈)
- POJ 1067 取石子游戏 威佐夫博弈
- POJ 1067 取石子游戏(威佐夫博弈)
- poj 1067 取石子游戏(威佐夫博弈)
- POJ 1067 取石子游戏(威佐夫博弈)