hdu1527 威佐夫博弈
1 #include<stdio.h> 2 #include<math.h> 3 int main() 4 { 5 int t,n,m,x; 6 while (~scanf("%d%d",&n,&m)) 7 { 8 if (n>m) {t=m; m=n; n=t; } 9 t=m-n; 10 x=t*(1+sqrt(5.0))/2; 11 if (x==n) printf("0\n"); 12 else printf("1\n"); 13 } 14 }
1 #include<stdio.h> 2 #include<math.h> 3 int main() 4 { 5 int t,n,m,x; 6 while (~scanf("%d%d",&n,&m)) 7 { 8 if (n>m) {t=m; m=n; n=t; } 9 t=m-n; 10 x=t*(1+sqrt(5.0))/2; 11 if (x==n) printf("0\n"); 12 else printf("1\n"); 13 } 14 }