40分求助!!

P1255 数楼梯

FALCONAD @ 2021-03-14 11:03:10

大佬们康康吧qwq

#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n,a[5001];
    cin>>n;
    a[1]=1;
    a[2]=2;
    if(n==1) cout<<1;
    if(n==2) cout<<2;
    for(int i=3;i<=n;i++)
    {
        a[i]=a[i-1]+a[i-2];
    }
    cout<<a[n];
    return 0;
}

by Alexia_Cosecant @ 2021-03-14 11:05:01

高精度


by FALCONAD @ 2021-03-14 11:05:51

还是得用高精度?qwq


|