特定数之和

n = int(input())
ans = 0
for i in range(1, n+1):
    t = i
    ok = False
    while t > 0:
        g = t % 10
        if g == 2 or g == 0 or g == 1 or g == 9:
            ok = True
        t = t // 10
 
    if ok:
        ans += i
print(ans)

 

posted @ 2020-06-21 16:38  tf383838  阅读(62)  评论(0编辑  收藏  举报