Submission
Status:
PPPPP-----
Subtask/Task Score:
50/100
Score: 50
User: sakuragichan
Problemset: อนุกรม
Language: cpp
Time: 0.002 second
Submitted On: 2026-09-05 22:38:02
#include <iostream>
using namespace std;
int main() {
int n ,n1 = 1 ,n2 = 1 , x = 0;
cin >> n;
if (n == 1 || n == 2) {
cout << 1 << endl;
return 0;
}
for (int i = 1; i <=n-2; i++) {
x = n1;
n1 += n2;
n2 = x;
}
cout << n1 << endl;
return 0;
}