Submission
Status:
PPPPP-----
Subtask/Task Score:
50/100
Score: 50
User: Karatat007
Problemset: อนุกรม
Language: cpp
Time: 0.004 second
Submitted On: 2026-09-17 15:21:34
#include <bits/stdc++.h>
using namespace std;
int main(){
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
int old = 1;
int nw = 1;
int n;
cin >> n;
if(n == 1 or n == 2){
cout << '1';
}
else{
for(int i = 1;i <= n - 2;++i){
nw = old + nw;
old = nw - old;
}
cout << nw;
}
}