Submission

Status:

PPPPPPPPPP

Subtask/Task Score:

100/100

Score: 100

User: pond4545

Problemset: Fibonacci Croissant

Language: cpp

Time: 0.003 second

Submitted On: 2025-09-25 14:58:37

#include <iostream>
#include <cmath>
using namespace std;
#define int long long

int32_t main()
{
    int n;
    int sum = 1;
    int present=0;
    int pre1 = 1;
    int pre2 = 0;
    cin >> n;
    for(int i = 2; i<=n; i++)
    {
        present=pre1+pre2;
        sum+=pre1+pre2;
        pre2=pre1;
        pre1=present;
    }
    cout << sum;
    return 0;
}