您的位置:首页 > 其它

北大ACM1067——取石子游戏

2015-09-17 16:38 295 查看
杭电1527的代码通不过。

AC的代码:

#include <iostream>
#include <cmath>
#include <algorithm>
using namespace std;

int main()
{
int a, b;
double k = (sqrt(5.0) + 1.0) / 2.0;
while(cin >> a >> b)
{
if(a > b)
swap(a, b);
int j = b - a;
int i = floor(j * k);
if(i == a)
cout << 0 << endl;
else
cout << 1 << endl;
}
return 0;
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: