Submission

Status:

PPPPPPPPPP

Subtask/Task Score:

100/100

Score: 100

User: PEPSEALSEA

Problemset: อนุกรม

Language: cpp

Time: 0.004 second

Submitted On: 2026-09-26 20:20:38

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

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

    int n;
    cin >> n;
    int temp = n;
    if (n<=2&&n>=1){
        cout << "1";
        return 0;
    }

    long long a = 1, b = 1, sum = 1;
    for (long long i = 3; i <= n; i++) {
        sum = a + b;
        a = b;
        b = sum;
    }
    cout << sum;
    return 0;
}