Skip to content

Commit e4a9f4c

Browse files
author
hangyeol
committed
102차 1번 문제풀이
1 parent 93dca17 commit e4a9f4c

1 file changed

Lines changed: 20 additions & 0 deletions

File tree

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
def main():
2+
n = int(input())
3+
4+
dp = [0] * (n + 1)
5+
dp[1] = 1
6+
7+
if n >= 2:
8+
dp[2] = 3
9+
10+
# 마지막에 2x1 타일을 세로로 놓았을 때 -> 1칸에만 들어감, 즉 한 칸만 비워져있어야 함 (i-1)
11+
# 마지막에 2x1 타일을 가로로 2개 놓았을 때 -> 2칸에 들어감, 즉 두 칸 비워져있어야 함 (i-2)
12+
# 마지막에 2x2 타일을 놓았을 때 -> 2칸에 들어감, 마찬가지로 두 칸 비워져있어야 함 (i-2)
13+
for i in range(3, n + 1):
14+
dp[i] = (dp[i - 1] + 2 * dp[i - 2]) % 10007
15+
16+
print(dp[n])
17+
18+
19+
if __name__ == "__main__":
20+
main()

0 commit comments

Comments
 (0)