관리 메뉴

Try

[Programmers/Python] 타일 장식물 본문

Algorithm/Programmers

[Programmers/Python] 타일 장식물

HAS3ONG 2019. 3. 23. 23:16

출처

https://programmers.co.kr/learn/courses/30/lessons/43104?language=python3


소스



1
2
3
4
5
6
7
8
9
10
11
12
13
14
def solution(N):
    answer = 0
    a1 = 1
    a2 = 1
    a3 = 0
    if N == 1:
        return 4
    else:
        for i in range(2, N):
            a3 = a1+a2
            a1 = a2
            a2 = a3
            
    return (a1+a2+a2)*2
cs


Comments