Submission
Status:
PPPPP-----
Subtask/Task Score:
50/100
Score: 50
User: PEPSEALSEA
Problemset: อนุกรม
Language: cpp
Time: 0.002 second
Submitted On: 2026-09-26 20:19:08
#include <bits/stdc++.h>
using namespace std;
int main(){
ios::sync_with_stdio(false);
cin.tie(nullptr);
int n;
cin >> n;
int temp = n;
if (n<=2){
cout << "1";
return 0;
}
int a = 1, b = 1, sum = 1;
for (int i = 3; i <= n; i++) {
sum = a + b;
a = b;
b = sum;
}
cout << sum;
return 0;
}