import java.io.*;
public class Main {
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
int n = Integer.parseInt(br.readLine());
long[][] dp = new long[n+1][10];
long ans = 0;
for(int i=1; i<=9; i++) { dp[1][i] = 1; }
for(int i=2; i<=n; i++) {
for(int j=0; j<=9; j++) {
if(j==0) { dp[i][j] = dp[i-1][1]%1_000_000_000; }
else if(j==9) { dp[i][j] = dp[i-1][8]%1_000_000_000; }
else { dp[i][j] = (dp[i-1][j-1]+dp[i-1][j+1])%1_000_000_000; }
}
}
for(int i=0; i<=9; i++) { ans += dp[n][i]; }
System.out.println(ans%1_000_000_000);
}
}
'Problem Solving > BOJ' 카테고리의 다른 글
[Silver 2] 11053번 가장 긴 증가하는 부분 수열 (0) | 2022.03.28 |
---|---|
[Silver 3] 2193번 이친수 (0) | 2022.03.28 |
[Silver 2] 15990번 1, 2, 3 더하기 5 (0) | 2022.03.28 |
[Silver 1] 16194번 카드 구매하기 2 (0) | 2022.03.28 |
[Silver 1] 11052번 카드 구매하기 (0) | 2022.03.28 |