#include<stdio.h> int main(void) { long long i,n,narr[55]; narr[1]=1;narr[2]=2;narr[3]=3; for(i=4;i<=50;i++) { narr[i]=narr[i-1]+narr[i-2]; } while(scanf("%d",&n)!=EOF) { printf("%lld\n",narr[n]); } return 0; }
时间: 2024-12-28 10:09:08
#include<stdio.h> int main(void) { long long i,n,narr[55]; narr[1]=1;narr[2]=2;narr[3]=3; for(i=4;i<=50;i++) { narr[i]=narr[i-1]+narr[i-2]; } while(scanf("%d",&n)!=EOF) { printf("%lld\n",narr[n]); } return 0; }