-
[Python] 백준 - 1904 01타일__Python/__Algorithm 2021. 12. 21. 18:33
# 백준 Silver3
# 1904 01타일
[문제]
링크 : https://www.acmicpc.net/problem/1904
[문제 풀이]
동적계획법
- 규칙 : 점화식이 피보나치 수열
[구현 코드]
import sys N = int(sys.stdin.readline()) tile = [0]*(N+1) for i in range(N+1): if i <= 2: tile[i] = i else: tile[i] = (tile[i-2]+tile[i-1])%15746 print(tile[N])
[실행 결과]
728x90'__Python > __Algorithm' 카테고리의 다른 글
[Python] 백준 - 9020 골드바흐의 추측 (0) 2022.01.07 [Python] 백준 - 2178 미로 탐색 (0) 2022.01.07 [Python] 백준 - 9184 신나는 함수 실행 (0) 2021.12.21 [Python] 백준 - 1003 피보나치 함수 (0) 2021.12.21 [Python] 백준 - 11047 동전 0 (0) 2021.12.20