Submission
Status:
PPPPP-----
Subtask/Task Score:
50/100
Score: 50
User: pottersk146
Problemset: อนุกรม
Language: cpp
Time: 0.002 second
Submitted On: 2026-10-06 16:51:17
#include <iostream>
using namespace std;
int main()
{
ios::sync_with_stdio(false);
cin.tie(nullptr);
int n, a, b, c;
cin >> n;
a = 1;
b = 1;
if(n == 1 || n == 2)
{
cout << 1;
return 0;
}
for(int i = 3; i <= n; i++)
{
c = a + b;
a = b;
b = c;
}
cout << b;
}