求助大神50分斐波那契算法

P1255 数楼梯

AD_McTorch @ 2024-04-13 16:58:27

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

by 729hao @ 2024-04-13 17:04:43

@Andrew_Ding 这道题需要高精度


by SwethessPotion @ 2024-04-13 17:05:51

要用高精的


by XXh0919 @ 2024-04-13 17:22:11

long long 60分,AC 要高精


by AD_McTorch @ 2024-04-16 21:21:31

okok


|