您的位置:首页 > 其它

51nod 1072 威佐夫游戏

2016-03-04 13:39 309 查看
简单的博弈论问题

#include <iostream>
#include <cstdio>
#include <cmath>

using namespace std;

int main()
{
int t;
cin >> t;
while (t--)
{
int a, b;
cin >> a >> b;
double t = (sqrt(5.0) + 1) / 2.0;
if (a > b)
{
int tmp = b;
b = a;
a = tmp;
}
//std::cout <<int(1.618 * (b - a))<< std::endl;
if (int(t* (b - a)) == a)
printf("B\n");
else
printf("A\n");
}

return 0;
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: