1 solutions

  • 0
    @ 2025-2-8 13:29:13
    #include<bits/stdc++.h>
    using namespace std;
    int main() 
    {
        long long d1 = 1, d2 = 1, d3, n;
        cin >> n;
        if (n == 1) {
            cout << 1;
            return 0;
        }
        int i = 3;
        while (true) 
        {
            d3 = d1 + d2;
            if (d3 >= n) 
              break;
            i++;
            d1 = d2;
            d2 = d3;
        }
        cout << i;
        return 0;
    }
    
    • 1

    Information

    ID
    9307
    Time
    1000ms
    Memory
    256MiB
    Difficulty
    6
    Tags
    # Submissions
    71
    Accepted
    7
    Uploaded By