[백준 1065][Python] 한수

봉글렛·2023년 1월 31일

백준

목록 보기
45/55

문제 링크 https://www.acmicpc.net/problem/1065

문제가 좀 안읽혀서 고생했음... 결국 각자리숫자에도 등차가 존제해야함.
ex) 111, 123, 135, 147

풀이

n = int(input())
result = 0
for i in range(1, n+1):
    if i < 100:
        result += 1
        continue
    if (i % 10//1) - (i % 100//10) == (i % 100//10) - (i % 1000//100):
        result += 1
if n == 1000:
    result -= 1
print(result)
profile
어쩌다 개발자 (할 수 있을 때까지!!!!)

0개의 댓글