def check(n):
numlist = []
while(True):
numlist.append(n % 10)
n = n // 10
if n == 0:
break
numlist.reverse()
diff = 0
for i in range(len(numlist)-1):
if i == 0:
diff = numlist[i+1] - numlist[i]
continue
new_diff = numlist[i+1] - numlist[i]
if diff != new_diff:
return False
return True
n = int(input())
cnt = 0
for num in range(1,n+1):
if check(num):
cnt += 1
print(cnt)
'알고리즘' 카테고리의 다른 글
백준_BruteForce_분해합 (0) | 2020.01.05 |
---|---|
백준_BruteForce_로또 (0) | 2019.12.28 |
백준_BruteForce_연구소 (0) | 2019.12.23 |
백준_BruteForce_퇴사 (0) | 2019.12.22 |
백준_BruteForce_일곱 난쟁이 (0) | 2019.12.22 |