| ||||||||||
| Online Judge | Problem Set | Authors | Online Contests | User | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest | |||||||||
1067的疑问?
我从网上找到关于取石子的游戏的原型(Wythoff Game),然后根据自己的理解写了一下算法
时间复杂度为0(1),在自己的机子上试了很多遍,没有错误,可是为什么总说我Wrong Error呢?
想请教一下各位大侠~~~谢谢
#include <iostream>
using namespace std;
int func(int x, int y);
int main()
{
int x, y;
int i, j;
while(cin>>i>>j)
{
x=i>j?j:i;
y=i+j-x;
cout<<func(x, y)<<endl;
}
return 0;
}
int func(int x, int y)
{
int j,i;
j=x*(2.23607-1)/2;
i=j*(2.23607+1)/2;
if(x==i)
{
if(y==x+j)
return 0;
else
return 1;
}
i=(j+1)*(2.23607+1)/2;
if(x==i)
{
if(y==(x+j+1))
return 0;
else return 1;
}
else
return 1;
}
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator