Submission
Status:
PPPPPPPPPP
Score: 100
User: punnatat5354
Problemset: อนุกรม
Language: cpp
Time: 0.003 second
Submitted On: 2025-01-12 20:35:26
#include<iostream>
#include<cmath>
using namespace std;
int main()
{
long long int a = 1 ;
long long int b = 1 ;
long long int n ;
long long int c ;
cin >> n ;
c = a + b ;
if (n >= 3){
n = n - 3 ;
for(int i = 1 ;i <= n ; i = i + 1){
a = b ;
b = c ;
c = a + b ;
}
cout << c ;
}
else{
cout << a ;
}
}