50分求调

P1255 数楼梯

zyh071 @ 2024-07-12 21:55:43

#include<bits/stdc++.h>
using namespace std;
int f(int n){
    if(n==1) return 1;
    if(n==2) return 2;
    return f(n-1)+f(n-2);
}
int main(){
    long long n;
    cin>>n;
    cout<<f(n);
    return 0;
}

前五个AC后五个WA


by pengzy @ 2024-07-12 22:02:03

@zyh071 高精


by zzhjidetuideng @ 2024-07-14 22:06:29

@zyh071 当n=5000时,答案超过了1e18


by lijundao123 @ 2024-07-18 21:04:51

@zhaozehan001 n==500时就超过了


|