1 #include2 #include 3 #include 4 #include 5 using namespace std; 6 7 int f[30],n; 8 9 int main()10 {11 f[0]=0;12 f[1]=1;13 for(int i=2; i<21; i++)14 {15 f[i]=f[i-1]+f[i-2];16 }17 while(scanf("%d",&n)!=EOF)18 {19 if(n<=20)20 {21 printf("%d\n",f[n]);22 continue;23 }24 else25 {26 double m=-0.5*log(5.0)/log(10.0)+((double)n)*log((sqrt(5.0)+1.0)/2.0)/(log(10.0));27 m-=floor(m);28 m=pow(10.0,m);29 while(m<1000)30 {31 m*=10;32 }33 printf("%d\n",(int)m);34 }35 }36 return 0;37 }