Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

21.07.23 - [BOJ] 2133. 타일 채우기 #145

Closed
suhyunsim opened this issue Jul 23, 2021 · 0 comments
Closed

21.07.23 - [BOJ] 2133. 타일 채우기 #145

suhyunsim opened this issue Jul 23, 2021 · 0 comments
Assignees
Labels
DP 다이나믹 프로그래밍 실버 BOJ - 실버 실패 시도했지만 맞지 못한 문제

Comments

@suhyunsim
Copy link
Owner

문제

핵심 아이디어

  • D[i] = 3 * D[i-2] + 2D[i-4] + 2D[i-6] + …

어려운 점, 실수

  • 더 구할 수 있는 방법에 대해 아이디어가 떠오르지 않았다.

풀이

package main.java.com.poogle.BOJ.Q2133;

import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        long[] d = new long[n + 1];
        d[0] = 1;
        for (int i = 2; i <= n; i += 2) {
            d[i] = d[i - 2] * 3;
            for (int j = i - 4; j >= 0; j -= 2) {
                d[i] += d[j] * 2;
            }
        }
        System.out.println(d[n]);
    }
}
@suhyunsim suhyunsim added 실패 시도했지만 맞지 못한 문제 실버 BOJ - 실버 DP 다이나믹 프로그래밍 labels Jul 23, 2021
@suhyunsim suhyunsim added this to the 7월 4주 차 milestone Jul 23, 2021
@suhyunsim suhyunsim self-assigned this Jul 23, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
DP 다이나믹 프로그래밍 실버 BOJ - 실버 실패 시도했지만 맞지 못한 문제
Projects
None yet
Development

No branches or pull requests

1 participant