File tree Expand file tree Collapse file tree 1 file changed +38
-0
lines changed
Expand file tree Collapse file tree 1 file changed +38
-0
lines changed Original file line number Diff line number Diff line change 1+ ``` java
2+ import java.io.* ;
3+
4+ public class BJ_2133_ 타일_채우기 {
5+
6+ private static final BufferedReader br = new BufferedReader (new InputStreamReader (System . in));
7+ private static final BufferedWriter bw = new BufferedWriter (new OutputStreamWriter (System . out));
8+
9+ private static int N ;
10+ private static int [] dp;
11+
12+ public static void main (String [] args ) throws IOException {
13+ init();
14+ sol();
15+ }
16+
17+ private static void init () throws IOException {
18+ N = Integer . parseInt(br. readLine());
19+ dp = new int [N + 1 ];
20+
21+ if (N <= 1 ) return ;
22+
23+ dp[0 ] = 1 ;
24+ dp[2 ] = 3 ;
25+ }
26+
27+ private static void sol () throws IOException {
28+ for (int i = 4 ; i <= N ; i += 2 ) {
29+ dp[i] = dp[i - 2 ] * 4 - dp[i - 4 ];
30+ }
31+ bw. write(dp[N ] + " \n " );
32+ bw. flush();
33+ bw. close();
34+ br. close();
35+ }
36+
37+ }
38+ ```
You can’t perform that action at this time.
0 commit comments