one_bunny @ 2024-03-16 16:34:41
#include<iostream>
#include<cstring>
#include<algorithm>
using namespace std;
const int N = 5050;
int n;
long long f[N];
int main(){
scanf("%d",&n);
f[1]=1,f[2]=2;
if(n==0){
printf("0\n");
}
if(n==1||n==2){
printf("%d\n",f[n]);
return 0;
}
for(int i=3;i<=n;i++){
f[i] = f[i-1] + f[i-2];
}
printf("%lld\n",f[n]);
return 0;
}
by kaaaai @ 2024-03-16 16:38:55
@one_bunny 这题前六个用例long long能过,后面要用高精度加
by one_bunny @ 2024-04-07 21:37:34
@kaaaai 好的,谢谢哇