practivceAlgorithm/백준

[백준][Python] 1436 영화감독숌

findTheValue 2021. 8. 10. 19:33

666을 찾아 떠나는 여행. 처음엔 666을 삽입하자는 생각이었으나

자릿수가 늘어날 수록 규칙이 계속 바뀌기 때문에 불가. 완전탐색으로 진행하였다

import sys
input = sys.stdin.readline

n = int(input())
cnt = 0
i=666
while cnt <=10000:
    if '666' in str(i):
        cnt += 1
    if cnt == n:
        print(i)
        break
    i+=1