斐波那契数列
#include<stdio.h>
int main(){
int n,i;
long long f[71]={0,1};
for(i=2;i<=70;i++)//记得是等于70
f[i]=f[i-1]+f[i-2];
while(scanf("%d",&n)!=EOF){
printf("%lld\n",f[n]);
}
return 0;
}//本题用递归会超时
斐波那契数列
#include<stdio.h>
int main(){
int n,i;
long long f[71]={0,1};
for(i=2;i<=70;i++)//记得是等于70
f[i]=f[i-1]+f[i-2];
while(scanf("%d",&n)!=EOF){
printf("%lld\n",f[n]);
}
return 0;
}//本题用递归会超时
转载于:https://www.cnblogs.com/xiao-wei-wei/p/3354799.html