Poj Solution 1067

http://poj.org/problem?id=1067

#include <iostream>
#include <algorithm>
#include <cmath>
#include <stdio.h>
using namespace std;
int main()
{
     int ax,bx,temp;
     int k,wantedax;
     while(scanf("%d%d",&ax,&bx)!=EOF) /*题中没有输入结标志时,必须这样写,否则会WA*/
     {
            if(ax>bx)
                swap(ax,bx);
            k = bx - ax;
            wantedax = (floor)( k*(1.0+sqrt(5.0))/2.0 );
            if(ax==wantedax)
                printf("%dn",0);
            else
                printf("%dn",1);
    }
    return 0;
}
											
This entry was posted in poj. Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *