Problem Solving/BOJ
[Gold 5] 2133번 타일 채우기
kmkunk
2022. 3. 29. 18:31
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());
int[] dp = new int[31];
dp[0] = 1;
for(int i=2; i<=n; i++) {
for(int j=1; j<=i/2; j++) {
dp[i] += dp[i-2*j]*2;
}
dp[i] += dp[i-2];
}
System.out.println(dp[n]);
}
}