Submission

Status:

PPPPPPPPPP

Subtask/Task Score:

100/100

Score: 100

User: wasupum

Problemset: อนุกรม

Language: cpp

Time: 0.003 second

Submitted On: 2025-12-14 10:29:19

#include <iostream>
using namespace std;
typedef long long ll;

ll memo[1000005];

ll fib(int n){
    if(memo[n] != 0){
        return memo[n];
    }else{
        memo[n] = fib(n-1)+fib(n-2);
        return memo[n];
    }
}

int main(void){
    memo[2] = 1;
    memo[1] = 1;
    int n;
    cin >> n;
    ll res = fib(n);
    cout << res;
    return 0;
}