less than 1 minute read

문제 유형 : 브루트포스


https://www.acmicpc.net/problem/1436

  • 브루트 포스로 처음부터 하나씩 돌아가면서 카운트를 세 666이 포함된 수를 찾았다.
  • 시간초과가 안나는 이유는 시간복잡도가 O(dn)이라서..?

solution

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