Submission
Status:
PPPPPPPPPP
Subtask/Task Score:
100/100
Score: 100
User: thitit
Problemset: Fibonacci Croissant
Language: cpp
Time: 0.003 second
Submitted On: 2026-11-05 22:27:05
#include <bits/stdc++.h>
using namespace std;
#define int long long
signed main () {
cin.tie(0)->sync_with_stdio(false);
int x;
cin >> x;
int a = 1;
int sum = 0;
int count = 0;
int temp;
if (x == 1) {
cout << "1";
return 0;
} else if (x == 2) {
cout << "2";
return 0;
} else {
for (int i = 0; i < x; i++) {
sum += a;
temp = a;
a = a + count;
count = temp;
}
cout << sum;
}
}