#include<iostream>
#include<cstdio>
/*1.1.2.3.5.8.13.21.34.55*/
using namespace std;
int fibo(int n){
int ans[1000]={0,1,1};
for(int i=3;i<=n;i++){
ans[i]=ans[i-1]+ans[i-2];
}
return ans[n];
}
void read(){
freopen("fibo.in","r",stdin);
freopen("fibo.out","w",stdout);
}
int main(){
read();
int n;
cin>>n;
cout<<fibo(n);
}
原文地址:https://www.cnblogs.com/1129-tangqiyuan/p/8474510.html
时间: 2024-10-24 22:59:25