标签:
Description
Input
Output
Sample Input
2 1 8 4 4 7
Sample Output
0 1 0
Source
1 #include<iostream> 2 #include<cstdio> 3 #include<cmath> 4 #include<cstring> 5 #include<cstdlib> 6 #include<algorithm> 7 #include<vector> 8 using namespace std; 9 int a,b,n,c; 10 11 inline int getint(){ 12 char c=getchar(); int w=0,q=0; 13 while(c!=‘-‘ && ( c<‘0‘ || c>‘9‘)) c=getchar(); 14 if(c==‘-‘) c=getchar(),q=1; 15 while(c>=‘0‘ && c<=‘9‘) w=w*10+c-‘0‘,c=getchar(); 16 return q?-w:w; 17 } 18 19 int main() 20 { 21 double arph=(sqrt(5.0)+1.0)/2.0;//黄金分割比 22 while(scanf("%d%d",&a,&b)!=EOF) { 23 if(a>b) swap(a,b); 24 n=b-a; 25 c=floor(n*arph); 26 if(c==a) printf("0\n"); 27 else printf("1\n"); 28 } 29 return 0; 30 }
标签:
原文地址:http://www.cnblogs.com/ljh2000-jump/p/5576185.html