Submission

Status:

PPPPPPPPPP

Subtask/Task Score:

100/100

Score: 100

User: Neozaawwman1

Problemset: อนุกรม

Language: cpp

Time: 0.002 second

Submitted On: 2025-10-06 21:43:06

#include <bits/stdc++.h>
using namespace std;
int main(){
    int n;
    cin >> n;
    if(n > 90) return 0; 

    long long x = 1, c = 1, sum = 1;

    if(n == 1 || n == 2){
        cout << 1;
        return 0;
    }

    for(int i = 3; i <= n; i++){
        sum = c + x;
        x = c;
        c = sum;
    }

    cout << sum;
    return 0;
}