60分求助

P1255 数楼梯

sui13127198996 @ 2023-08-22 19:05:02


#include<bits/stdc++.h>
using namespace std;
long long f[5001]; 
int main(){
    int n;
    cin>>n;
    f[1]=1;
    f[2]=2;
    for(int i=3;i<=n;i++){
        f[i]=f[i-1]+f[i-2];
    }
    cout<<f[n];
    return 0;
}
求大佬帮助,非常感谢

by _Anonymous_ @ 2023-08-22 19:09:46

@sui13127198996

高精度,n的范围到5000


by sui13127198996 @ 2023-08-22 19:10:29

@Anonymous 感谢,已关注


|