Submission
Status:
PPPPPPPPPP
Subtask/Task Score:
100/100
Score: 100
User: NANO..
Problemset: อนุกรม
Language: cpp
Time: 0.003 second
Submitted On: 2026-11-15 19:24:28
#include <bits/stdc++.h>
using namespace std;
long long memo[101];
long long solve(int n){
if(memo[n]!=-1) return memo[n];
if(n<=2) return 1;
return memo[n]=solve(n-1)+solve(n-2);
}
int main(){
int n;
cin >> n;
memset(memo,-1,sizeof(memo));
cout << solve(n);
return 0;
}