1 #include<iostream> 2 #include<cmath> 3 using namespace std; 4 int a[21]={0,1}; 5 int main() 6 { 7 int n; 8 double m,l,des; 9 while(~scanf("%d",&n)) 10 { 11 for(int i=2;i<=20;i++) 12 { 13 a[i]=a[i-1]+a[i-2]; 14 } 15 if(n<=20)printf("%d\n",a[n]); 16 else 17 { 18 m=(1.0+sqrt(5.0))/2.0; 19 l=-log10(5.0)*0.5+n*1.0*log10(m); 20 l-=(int)l; 21 des=pow(10.0,l); 22 while(des<1000) 23 { 24 des*=10; 25 } 26 printf("%d\n",(int)des); 27 } 28 } 29 return 0; 30 }