본문 바로가기
Beakjoon&프로그래머스/파이썬

[백준/파이썬]17210번 문문문

by 현장 2021. 3. 30.

-코드

n = int(input())
o = int(input())

if n <= 5:
    for i in range(n - 1):
        if o == 0:
            if i % 2 == 0:
                print(1)
            else:
                print(0)
        else:
            if i % 2 == 0:
                print(0)
            else:
                print(1)

else:
    print("Love is open door")

처음에 문제를 이해를 못해서 찾아보니 그냥 n이 6이 되는 순간부터 2의 배수와 3의 배수가 겹쳐서 탈출이 불가능하게 된다는 것을 알고 해결하였습니다.