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

[백준/파이썬] 18312번 시각

by 현장 2022. 5. 5.

-Code

n, k = map(int, input().split())
k = str(k)
cnt = 0
for h in range(n + 1):
    h = str(h)
    if int(h) < 10:
        h = '0' + h
    for m in range(60):
        m = str(m)
        if int(m) < 10:
            m = '0' + m
        for s in range(60):
            s = str(s)
            if int(s) < 10:
                s = '0' + s
            if k in h + m + s:
                cnt += 1

print(cnt)

10미만의 수일 때, 0이 안붙어서 틀렸었습니다.