Skip to content

Commit 11059c2

Browse files
committed
[Silver III] Title: 2×n 타일링 2, Time: 172 ms, Memory: 17784 KB -BaekjoonHub
1 parent 82f2172 commit 11059c2

2 files changed

Lines changed: 56 additions & 0 deletions

File tree

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
import java.util.*;
2+
3+
public class Main {
4+
// static Long[] DP = new Long[1001];
5+
static Integer[] DP = new Integer[1001];
6+
public static void main(String[] args) {
7+
Scanner sc = new Scanner(System.in);
8+
int N = sc.nextInt();
9+
10+
// DP[1] = 1L;
11+
// DP[2] = 3L;
12+
DP[1] = 1;
13+
DP[2] = 3;
14+
15+
for(int i = 3; i<=N; i++){
16+
DP[i] = (DP[i-1] + 2 * DP[i-2]) % 10007;
17+
// DP[i] = (DP[i-1] + 2 * DP[i-2]);
18+
}
19+
20+
System.out.println(DP[N]);
21+
// System.out.println(DP[N] % 10007);
22+
}
23+
24+
}
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# [Silver III] 2×n 타일링 2 - 11727
2+
3+
[문제 링크](https://www.acmicpc.net/problem/11727)
4+
5+
### 성능 요약
6+
7+
메모리: 17784 KB, 시간: 172 ms
8+
9+
### 분류
10+
11+
다이나믹 프로그래밍
12+
13+
### 제출 일자
14+
15+
2025년 5월 4일 16:43:21
16+
17+
### 문제 설명
18+
19+
<p>2×n 직사각형을 1×2, 2×1과 2×2 타일로 채우는 방법의 수를 구하는 프로그램을 작성하시오.</p>
20+
21+
<p>아래 그림은 2×17 직사각형을 채운 한가지 예이다.</p>
22+
23+
<p style="text-align: center;"><img alt="" src="https://www.acmicpc.net/upload/images/t2n2122.gif" style="height:59px; width:380px"></p>
24+
25+
### 입력
26+
27+
<p>첫째 줄에 n이 주어진다. (1 ≤ n ≤ 1,000)</p>
28+
29+
### 출력
30+
31+
<p>첫째 줄에 2×n 크기의 직사각형을 채우는 방법의 수를 10,007로 나눈 나머지를 출력한다.</p>
32+

0 commit comments

Comments
 (0)