60分 记忆化迭代 求助

P1255 数楼梯

xingjielong @ 2023-12-23 17:20:09

#include<bits/stdc++.h>
using namespace std;
long long f[5010];
int main(){
    int n;
    f[0]=1;f[1]=1;
    scanf("%d",&n);
    for(int i=2;i<=n+1;i++){
        f[i]=f[i-1]+f[i-2];
    }
    cout << f[n];
    return 0;
}

求助! 记录


by _YTY_ @ 2023-12-23 17:23:00

要高精


by xiaoshumiao @ 2023-12-23 17:23:15

@xingjielong 此题需要高精度。


by Fractured_Angel @ 2023-12-23 17:43:26

?记忆化迭代是啥?


by xingjielong @ 2023-12-23 18:06:34

@the_long_way_to_dp 哦,搞错了,应该叫预处理


by xingjielong @ 2023-12-23 18:07:36

@xiaoshumiao 谢了


|