Submission

Status:

PPPPPPPPPP

Subtask/Task Score:

100/100

Score: 100

User: Kidmaiok

Problemset: อนุกรม

Language: cpp

Time: 0.004 second

Submitted On: 2026-10-10 11:45:54

#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ull unsigned long long
#define space << ' '
#define nl << endl

long long arr[95] = {1,1};
int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    
    long long n;
    cin >> n;
    if(n == 1 || n == 2) {
        cout << 1;
        return 0;
    }else{
        for(long long i =2; i < n; i++){
            arr[i] = arr[i-1] + arr[i-2];
        }
    }
    cout << arr[n-1];
    
}