Submission

Status:

PPPPPPPPPP

Subtask/Task Score:

100/100

Score: 100

User: JRomsponCH

Problemset: Fibonacci Croissant

Language: cpp

Time: 0.003 second

Submitted On: 2025-09-30 13:27:32

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

int main() {
    long long n;
    long long sum = 1;
    cin>>n;
    for (int i = 0; i <= n; i++) {
        long long n2 = 0;
        long long n1 = 1;
        long long total = 0;
        for (int j = 2; j <= i; j++) {
            total = n2 + n1;
            n2 = n1;
            n1 = total;
        }
        sum += total;
    }
    cout<<sum;
}