WA

P1255 数楼梯

z___u___y @ 2023-08-24 14:35:03


#include<bits/stdc++.h>
using namespace std;
int n;
int f[99999];
int main(){
    cin>>n;
    f[1]=1;
    f[2]=2;
    int gg=0;
    for(int i=1;i<=n;i++){
        if(i<=2){
        }else
        {
            f[i]=f[i-1]+f[i-2];
        }
        gg++;
    }
    cout<<gg;
}

by zhaojianchao @ 2023-08-24 14:38:20

@zuy 要用高精度


by gjc1108 @ 2023-08-24 14:45:11

@Br00k5xx

要高精啊


by BLX32M_10 @ 2023-08-24 14:46:06

@gjc1108 哦, 好像可以pypy()


by zqhbxsgs @ 2023-10-27 22:28:49

@zuy 你不仅没用高精度,而且你这输出也有问题,应该输出f[n]。


|