Submission
Status:
PPPPPPPPPP
Subtask/Task Score:
100/100
Score: 100
User: samsenpisardmoo69
Problemset: อนุกรม
Language: cpp
Time: 0.002 second
Submitted On: 2026-10-02 14:11:58
#include <bits/stdc++.h>
using namespace std;
long long fib(int n)
{
long long a = 0;
long long b = 1;
for(int i=0; i<n; i++)
{
long long c = a+b;
a = b;
b = c;
}
return a;
}
int main()
{
int n;
cin >> n;
long long ans = fib(n);
cout << ans;
}