Submission

Status:

-PPPPPPPPP

Subtask/Task Score:

90/100

Score: 90

User: Karatat007

Problemset: อนุกรม

Language: cpp

Time: 0.004 second

Submitted On: 2026-09-17 15:27:30

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

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);

    long long old = 1;
    long long nw = 1;
    int n;
    cin >> n;
    if(n == 1 or n == 2){
        cout << '1';
    }
    for(int i = 1; i <= n - 2; ++i){
            nw = old + nw;
            old = nw - old;
    }
    cout << nw << '\n';
}