Submission

Status:

-PPP------

Subtask/Task Score:

30/100

Score: 30

User: Karatat007

Problemset: อนุกรม

Language: cpp

Time: 0.004 second

Submitted On: 2026-09-17 15:26:15

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

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

    long double old = 1;
    long double 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';
}