#include <stdio.h>
int dp[1001];
int top_down(int n) {
if(n==1) return 1;
if(n==2) return 2;
//계산이 이미 됨
if(dp[n]!=-1) return dp[n];
dp[n]=(top_down(n-2)+top_down(n-1))%10007;
return dp[n];
}
int main() {
int n;
scanf("%d",&n);
for(int i=0; i<=n; i++) {
dp[i]=-1;
}
printf("%d",top_down(n));
return 0;
}
To embed this project on your website, copy the following code and paste it into your website's HTML: