本蒟蒻求助(SOS)

P1255 数楼梯

Minecraft__YYDS @ 2022-07-19 21:31:45

#include <iostream>
#include <cstdio> 
#define sc scanf
#define pr printf
using namespace std;

int n;
int f[1005];

int main()
{
    sc ("%d",&n);
    f[1]=1;
    f[2]=2;

    for (int i=3; i<=n; i++)
    {
        f[i]=f[i-1]+f[i-2];
    }

    if (n!=0)
    {
        pr ("%d",f[n]);
    }   
    else if (n==0)
    {
        pr ("0");   
    }   
    return 0;
}

by yinhee @ 2022-07-19 21:32:53

请仔细观察标签


by SH01RuLai @ 2022-07-19 21:33:10

@Minecraft__YYDS 这题要高精度


by yinhee @ 2022-07-19 21:33:30

@kirihara233 没问题啊


by Minecraft__YYDS @ 2022-07-19 21:33:59

运行是对的 4 7 8三个点WA 9 10 RE


by char_cha_ch @ 2022-07-19 21:34:14

@yinhee 额,忘了,平常数列应该是112的


|