백준 #1065

sese·2022년 1월 5일
0

python

x = int(input())

def hansu(x: int):
    count = 0
    for i in range(1, x+1):
        n = list(map(int, str(i)))  # 110 -> [1, 1, 0]
        if i < 100:  # 1~99는 모두 한수이다.
            count += 1
        elif n[0] - n[1] == n[1] - n[2]:
            count += 1
    return count

print(hansu(x))
profile
예전 글은 다크모드로 봐야 잘 보일 수도 있습니다.

0개의 댓글

관련 채용 정보