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