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]);
}
}'Problem Solving > BOJ' 카테고리의 다른 글
| [Silver 3] 3085번 사탕 게임 (0) | 2022.04.01 |
|---|---|
| [Gold 4] 17404번 RGB거리 2 (0) | 2022.03.29 |
| [Gold 5] 13398번 연속합 2 (0) | 2022.03.29 |
| [Gold 3] 11054번 가장 긴 바이토닉 부분 수열 (0) | 2022.03.29 |
| [Silver 2] 11722번 가장 긴 감소하는 부분 수열 (0) | 2022.03.29 |