Skip to content

Commit 0bd83ca

Browse files
committed
[level 2] Title: 2 x n 타일링, Time: 5.17 ms, Memory: 9.29 MB -BaekjoonHub
1 parent 7324a4d commit 0bd83ca

File tree

2 files changed

+81
-0
lines changed

2 files changed

+81
-0
lines changed
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
def solution(n):
2+
if n == 1:
3+
return 1
4+
a, b = 1, 2
5+
for i in range(3, n + 1):
6+
a, b = b, (a + b) % 1000000007
7+
return b
Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
# [level 2] 2 x n 타일링 - 12900
2+
3+
[문제 링크](https://school.programmers.co.kr/learn/courses/30/lessons/12900)
4+
5+
### 성능 요약
6+
7+
메모리: 9.29 MB, 시간: 5.17 ms
8+
9+
### 구분
10+
11+
코딩테스트 연습 > 연습문제
12+
13+
### 채점결과
14+
15+
정확성: 70.0<br/>효율성: 30.0<br/>합계: 100.0 / 100.0
16+
17+
### 제출 일자
18+
19+
2026년 02월 03일 21:02:14
20+
21+
### 문제 설명
22+
23+
<p>가로 길이가 2이고 세로의 길이가 1인 직사각형모양의 타일이 있습니다. 이 직사각형 타일을 이용하여 세로의 길이가 2이고 가로의 길이가 n인 바닥을 가득 채우려고 합니다. 타일을 채울 때는 다음과 같이 2가지 방법이 있습니다.</p>
24+
25+
<ul>
26+
<li>타일을 가로로 배치 하는 경우</li>
27+
<li>타일을 세로로 배치 하는 경우</li>
28+
</ul>
29+
30+
<p>예를들어서 n이 7인 직사각형은 다음과 같이 채울 수 있습니다.</p>
31+
32+
<p><img src="https://i.imgur.com/29ANX0f.png" title="" alt="Imgur"></p>
33+
34+
<p>직사각형의 가로의 길이 n이 매개변수로 주어질 때, 이 직사각형을 채우는 방법의 수를 return 하는 solution 함수를 완성해주세요.</p>
35+
36+
<h5>제한사항</h5>
37+
38+
<ul>
39+
<li>가로의 길이 n은 60,000이하의 자연수 입니다.</li>
40+
<li>경우의 수가 많아 질 수 있으므로, 경우의 수를 1,000,000,007으로 나눈 나머지를 return해주세요.</li>
41+
</ul>
42+
43+
<hr>
44+
45+
<h5>입출력 예</h5>
46+
<table class="table">
47+
<thead><tr>
48+
<th>n</th>
49+
<th>result</th>
50+
</tr>
51+
</thead>
52+
<tbody><tr>
53+
<td>4</td>
54+
<td>5</td>
55+
</tr>
56+
</tbody>
57+
</table>
58+
<h5>입출력 예 설명</h5>
59+
60+
<p>입출력 예 #1<br>
61+
다음과 같이 5가지 방법이 있다.</p>
62+
63+
<p><img src="https://i.imgur.com/keiKrD3.png" title="" alt="Imgur"></p>
64+
65+
<p><img src="https://i.imgur.com/O9GdTE0.png" title="" alt="Imgur"></p>
66+
67+
<p><img src="https://i.imgur.com/IZBmc6M.png" title="" alt="Imgur"></p>
68+
69+
<p><img src="https://i.imgur.com/29LWVzK.png" title="" alt="Imgur"></p>
70+
71+
<p><img src="https://i.imgur.com/z64JbNf.png" title="" alt="Imgur"></p>
72+
73+
74+
> 출처: 프로그래머스 코딩 테스트 연습, https://school.programmers.co.kr/learn/challenges

0 commit comments

Comments
 (0)