北大acm 1067 取石子

来源:百度知道 编辑:UC知道 时间:2024/05/09 19:34:44
代码
#include<iostream>
using namespace std;

long x,y;

int main()
{
while(cin>>x>>y)
{
if(x==y)
cout<<"1"<<endl;
else
{
long max,min;
max=x;
min=y;
if(y>x)
{
max=y;
min=x;
}
if(min==1&&max==2) cout<<"0"<<endl;
else if(min!=2&&(2*min==max+1)) cout<<"0"<<endl;
else cout<<"1"<<endl;
}
}
return 0;
}
WA 求错误
我的程序,不知为啥错了
求大牛请教

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

叙述的通俗易懂别人才能理解,别人才能有可能帮你

啥意思