반응형
import java.util.Scanner;
public class Main{
static public void main(String args[]){
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
long dp [][]=new long [n][10];
for(int i=0;i<10;i++){
dp[0][i]=1;
}
for(int i=1;i<n;i++){
dp[i][0]=1;
}
//점화식 dp[n-1][idx]=dp[n-1][idx-1]+dp[n-2][idx]
for(int i=1;i<n;i++){
for(int j=1;j<10;j++){
dp[i][j]=dp[i][j-1]+dp[i-1][j];
if(dp[i][j]>10007) dp[i][j]=dp[i][j]%10007;
}
}
int sum=0;
for(int i=0;i<10;i++){
sum+=dp[n-1][i];
}
System.out.println(sum%10007);
}
}
반응형
댓글