1 solutions

  • 0
    @ 2026-11-5 20:15:32

    ··· #include<bits/stdc++.h> using namespace std;

    int fib(int n) { if(n == 1 || n == 2) // 递归出口(基线条件) return 1; return fib(n-1) + fib(n-2); // 递推公式 }

    int main() { int n; cin >> n; cout << fib(n) << endl; return 0; } ···

    • 1

    Information

    ID
    307
    Time
    1000ms
    Memory
    256MiB
    Difficulty
    1
    Tags
    (None)
    # Submissions
    39
    Accepted
    13
    Uploaded By