Dazzling 개발 노트

[백준] 11727 - 2 x N 타일링2 (Java) 본문

Algorithm/백준

[백준] 11727 - 2 x N 타일링2 (Java)

dj._.dazzling 2023. 7. 20. 17:54

문제

https://www.acmicpc.net/problem/11727

풀이/후기

이코테에서 풀었던 바닥 공사 문제와 완전히 동일하다

https://da-zzling.tistory.com/37

코드

package DynamicProgramming;

import java.io.*;

public class Problem11727 {
	static int[] d = new int[1000 + 1];

	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		int N = Integer.parseInt(br.readLine());

		d[1] = 1;
		d[2] = 3;
		for (int i = 3; i < N + 1; i++) {
			d[i] = (d[i - 1] + d[i - 2] * 2) % 10007;
		}

		System.out.println(d[N]);
	}
}

Commit

https://github.com/allrightDJ0108/CodingTestStudy/commit/f9e28488dfc32c2ec348c7c169592ba7b32632fd

참고