| ||||||||||
| 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 | |||||||||
Re:有两个问题我想请教:In Reply To:Re:有两个问题我想请教: Posted by:frkstyc at 2005-05-08 00:05:58 > 1.是0
> 2.Wythoff's Game的解只有这个Betty序列,没有其他的
>
谢谢!但为什么我的这个算法不对呢?是不是漏了什么地方?
#include <iostream>
#include <cmath>
using namespace std;
void main()
{
int a, b, t;
double h = (sqrt(5) + 1) / 2;
while(cin>>a>>b)
{
if(a < b)
{
t = a / h;
if(t != a / h)
t = t + 1;
if(b == a + t)
cout<<0<<endl;
else
cout<<1<<endl;
}
else
{
t = b / h;
if(t != b / h)
t = t + 1;
if(a == b + t)
cout<<0<<endl;
else
cout<<1<<endl;
}
}
}
Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator