-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Silver III] Title: 2×n 타일링, Time: 36 ms, Memory: 31120 KB -BaekjoonHub
- Loading branch information
1 parent
777c45e
commit 802e172
Showing
2 changed files
with
53 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
""" | ||
d[i] = d[i-1] + d[i-2] | ||
""" | ||
|
||
import sys | ||
|
||
readline = lambda: sys.stdin.readline().strip() | ||
#readline = input | ||
|
||
MOD = 10007 | ||
|
||
n = int(readline()) | ||
SIZE = n + 1 | ||
dp = [0] * SIZE | ||
dp[0] = 1 | ||
dp[1] = 1 | ||
|
||
for i in range(2, SIZE): | ||
dp[i] = dp[i - 1] + dp[i - 2] | ||
|
||
print(dp[n]%MOD) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
# [Silver III] 2×n 타일링 - 11726 | ||
|
||
[문제 링크](https://www.acmicpc.net/problem/11726) | ||
|
||
### 성능 요약 | ||
|
||
메모리: 31120 KB, 시간: 36 ms | ||
|
||
### 분류 | ||
|
||
다이나믹 프로그래밍 | ||
|
||
### 제출 일자 | ||
|
||
2024년 9월 13일 12:04:00 | ||
|
||
### 문제 설명 | ||
|
||
<p>2×n 크기의 직사각형을 1×2, 2×1 타일로 채우는 방법의 수를 구하는 프로그램을 작성하시오.</p> | ||
|
||
<p>아래 그림은 2×5 크기의 직사각형을 채운 한 가지 방법의 예이다.</p> | ||
|
||
<p style="text-align: center;"><img alt="" src="https://onlinejudgeimages.s3-ap-northeast-1.amazonaws.com/problem/11726/1.png" style="height:50px; width:125px"></p> | ||
|
||
### 입력 | ||
|
||
<p>첫째 줄에 n이 주어진다. (1 ≤ n ≤ 1,000)</p> | ||
|
||
### 출력 | ||
|
||
<p>첫째 줄에 2×n 크기의 직사각형을 채우는 방법의 수를 10,007로 나눈 나머지를 출력한다.</p> | ||
|