标签:
题目:
Description
Input
Output
Sample Input
Sample Output
1 #include<cstdio> 2 #include<cmath> 3 int main() 4 { 5 int a,b,k; 6 double eps=(1+sqrt(5.0))/2.0; 7 while(scanf("%d%d",&a,&b)==2&&(a||b)) 8 { 9 int t; 10 if(a>b) 11 { 12 t=a; 13 a=b; 14 b=t; 15 } 16 k=b-a; 17 if(int(k*eps)==a) 18 printf("0\n"); 19 else 20 { 21 printf("1\n"); 22 for(int i=1;i<=a;i++) 23 { 24 int n,m; 25 n=a-i; 26 m=b-i; 27 if(n>m) 28 { 29 t=n; 30 n=m; 31 m=t; 32 } 33 k=m-n; 34 if(int(k*eps)==n) 35 printf("%d %d\n",n,m); 36 } 37 for(int i=b-1;i>=0;i--) 38 { 39 int n,m; 40 n=a; 41 m=i; 42 if(n>m) 43 { 44 t=n; 45 n=m; 46 m=t; 47 } 48 k=m-n; 49 if(int(k*eps)==n) 50 printf("%d %d\n",n,m); 51 } 52 } 53 } 54 return 0; 55 }
标签:
原文地址:http://www.cnblogs.com/forwin/p/4890439.html