Submission

Status:

PPPPPPPPPP

Subtask/Task Score:

100/100

Score: 100

User: onlyme910

Problemset: อนุกรม

Language: cpp

Time: 0.003 second

Submitted On: 2025-10-08 19:49:11

#include <bits/stdc++.h>
using namespace std;

int main(){
    long long int s = 1,e = 1,n,k;
    cin >> n;
    if(n < 3 && n > 0){
        cout << s;
    }
    else{
        for(int i =2;i<n;i++){
            k = s+e;
            s = e;
            e = k;
        }
        cout << k;
    }
}