Submission

Status:
PPPPP-----

Score: 50

User: mydKN

Problemset: อนุกรม

Language: c

Time: 0.002 second

Submitted On: 2024-10-14 21:58:15

#include<stdio.h>

#define ll long long
#define maxn 100

ll memo[maxn];

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

int main(){
    int n;
    scanf("%d", &n);
    memo[0] = 0;
    memo[1] = 1;
    printf("%d", fibo(n));
}