C++60分四个WA求助大佬

P1255 数楼梯

Leibyi_233 @ 2022-08-10 08:32:54

#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
using namespace std;
int main()
{
    long long a[5010],n;
    a[0]=0;
    a[1]=1;
    a[2]=2;
    cin>>n;
    for(int i=3;i<=n;i++)
    a[i]=a[i-1]+a[i-2];
    printf("%ld",a[n]);
    return 0;
}

by randnameaaa @ 2022-08-10 08:48:16

得用高精度加法才能过


by Leibyi_233 @ 2022-08-10 14:26:16

@randnameaaa 谢佬我试试


|