OneCompiler

파이썬 369 박수세기

1630

n = int(input())

cnt = 0

def is369 (n):
cnt = 0
while n > 0:
if n % 10 == 3 or n % 10 == 6 or n % 10 == 9:
cnt += 1
n //= 10
return cnt

for i in range(1,n+1):
cnt += is369(i)
print(cnt)