1 #include<stdio.h> 2 long long a[51]; 3 int main() 4 { 5 int n,i; 6 a[1]=1; 7 for(i=2; i<51; ++i) 8 a[i]=a[i-1]+a[i-2]; 9 while(~scanf("%d",&n) && n!=-1) 10 printf("%lld ",a[n]); 11 }
1 #include<stdio.h> 2 long long a[51]; 3 int main() 4 { 5 int n,i; 6 a[1]=1; 7 for(i=2; i<51; ++i) 8 a[i]=a[i-1]+a[i-2]; 9 while(~scanf("%d",&n) && n!=-1) 10 printf("%lld ",a[n]); 11 }