POJ 1067 威佐夫博弈

View Code
 1 #include<stdio.h>
 2 #include<math.h>
 3 
 4 int main()
 5 {
 6   int a,b;
 7   double con=(1+sqrt(5.0))/2;
 8   while(scanf("%d%d",&a,&b)!=EOF)
 9    {
10      if(a>b)
11      {
12        a^=b;
13        b^=a;
14        a^=b;
15      }
16      int k=b-a;
17      if(a==(int)(con*k))printf("0\n");
18      else printf("1\n");
19    }
20   return 0;
21 }

 

posted @ 2012-04-11 20:05  知行执行  阅读(152)  评论(0编辑  收藏  举报