joshua_song @ 2022-03-13 10:42:41
#include<bits/stdc++.h>
using namespace std;
int fib(int x)
{
vector <int> f;
f.push_back(0);
f.push_back(1);
f.push_back(2);
if(x==1||x==2)
return x;
for(int i=3;i<=x+1;i++)
f.push_back(f[i-2]+f[i-1]);
return f[x];
}
int main()
{
int x;
cin>>x;
cout<<fib(x)<<endl;
return 0;
}
by zyx15801617101 @ 2022-03-13 14:40:31
@joshua_song 没事