알고리즘

<백준> 1436번 파이썬 알고리즘

changha. 2021. 7. 5. 15:46
n = int(input())
nth = 666
cnt = 0

while True:
    if '666' in str(nth):
        cnt += 1
    if cnt == n:
        print(nth)
        break
    nth += 1

처음에 단순히 666 앞에 숫자만 붙이면 되는건줄 알았는데

그럴리가 없어 다시 생각해보고 결국 다른 블로그를 참고했다

 

주어진 범위에서 모든 경우를 생각하는 문제다