poj 1067
做法和ssn不一样
因为 a<=i * (sqrt(5)+1)/2<b
所以 a * e<=i< b *e //e=(sqrt(5)-1)/2
因为对于每一个a,b符合条件的i有且只有一个
所以得出AC代码(压行技巧没ssn高超)
#include<cstdio>
#include<cmath>
#include<iostream>
using namespace std;
double e,d;
int p,q,x;
int main(){
freopen("data.txt","r",stdin);
freopen("1.txt","w",stdout);
e=(sqrt(5)-1)/2;
d=(sqrt(5)+1)/2;
while(scanf("%d%d",&p,&q)==2){
if(p==0&&q==0){
printf("0\n");
continue;
}
if(p>q)swap(p,q);
if((x=ceil(p*e))<q*e&&q==x+p&&floor(x*d)==p)printf("0\n");
else printf("1\n");
}
}