코딩테스트 준비

백준 1065번 한수

언어 수집가 2021. 2. 6. 15:54
n = int(input())
result = 0
if n <= 99:
result = n
else:
result = 99
for j in range(100, n+1):
h = True
s = str(j)
length = len(s)
for i in range(length-2):
if int(s[i]) + int(s[i+2]) != 2 * int(s[i+1]):
h = False
if h:
result += 1
print(result)