Problem:


Score : 200 points

Problem Statement

Find the sum of the integers between 1 and N (inclusive), whose sum of digits written in base 10 is between A and B (inclusive).

Constraints

1 \leq N \leq 10^4

1 \leq A \leq B \leq 36

All input values are integers.

Input

Input is given from Standard Input in the following format:

N A B

Output

Print the sum of the integers between 1 and N (inclusive), whose sum of digits written in base 10 is between A and B (inclusive).

Sample Input 1

20 2 5

Sample Output 1

84

Among the integers not greater than 20, the ones whose sums of digits are between 2 and 5, are: 2,3,4,5,11,12,13,14 and 20. We should print the sum of these, 84.

Sample Input 2

10 1 2

Sample Output 2

13

Sample Input 3

100 4 16

Sample Output 3

4554



Sample input:
20 2 5


Sample output:
84

Submission status: Accepted

Solution code:
import subprocess
import gzip, base64, os
import stat

gz = b'H4sIAMWaaF0C/+19e2AURbZ3TyaPCY9MQNDwkqBBgkjIkAAJrpIAAz0ywUgA8QHNJJmQ6CSTnemBxF2V3SSuwxDlul5X9+HHt7vXq+6Lu+51UVcIIgQf6yIIiyKCLGAPEYlXhCALc8+pqp5U93RH0P2+vxgNNedXp07VOXXqVFX3dNeDTvecJItFUD9Jws0CUmNGlBC6hOFNVXEWwIqEdPh3tDBSSAU6heMrEUo0aQ8TraY2xmeFv2T4K0qidFFSiSYdyfjU1MKlKQL/KdGkq28TNKkgZMfLYVv3LaXovqXLNSlpDHwy07Tlkli5Hlauh/GrqZAkaFJVv2T2t5DhC5leajqb8c0WNNUL5UflamIXN7OLu0STyoxP1pW7DcqlChf/yWTpAlafmV1yWfvVVO2HSb66yqmFk3zVE311DaGmiU1FUydOLcwL+vMmkzZlMt658xdp7JjF2jyE+QDm/3bb+dL/DD321qbJL18Rtrx6zzBHzpuYN42Vwy5pa8isTR6TnmQRCoXVIBrzpsPfDPj744cFe/r9YJ30i6pXtz1SH9vxcFvVle9VrG9Ze0fJ5xM/l5ZlZK/Mz3XucXccv65jyJMDZj09snFjs+veF/uyzxFowGADfHeSMT7JYoz/UTDGM+Mepv2MNsH/lmIs534T/C2TettN+NNSjfFyE/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Rxbq22DA2ZJah3jsyK1ssmxjgxi5y0mHNCoy+7zIE59yxOOtNT3aO+xkYnVmBwfm9h9pke9JtSGPx2A/vX5pPjBuN/sIFydGfEsTAMFEg/K1bWoz5OSb5XIs59SKOitTjwg13AcmR1aq2Wmh3bq2tvHwcz64Wx69rKR4yacSmrYcKOjlQ3GiMHBqXoug7N49W4A6qmxLuEk4kTvIgfYJsLc0cp6+dVBv1QLcygYj56YajjCMI6xxdG/8AhofURi567qnVN7hLFeu8TDf/UqVgaDnEfEz79O6IyLOhS3pIQ75DXxKF/DmJFwrm+iEO3Zx0ZStAeLayUYHkducoq3VjY9/9YgHHyz06x1ocbrr9G7U/zMb60GZJb+ZidK6+okD5snuNBFH+hsMOEanLJuNtxNDss26k/utG2dKcgvm4yOyU50m3/BcdAG06CBdvGz2HV5mjOYIY+dj6w/Yj3Rqupp2QZrF3retUEj9IeBJ7pyY3NvzzsKE8+U1pXAI51pXPtfEAFLJbOJAAA='
bin = gzip.decompress(base64.b64decode(gz))
p = os.path.dirname(__file__)
pymain = os.path.join(p, "a.out")
with open(pymain, "wb") as f:
    f.write(bin)
os.chmod(pymain, stat.S_IRUSR | stat.S_IWUSR | stat.S_IXUSR)
if p == "":
    pymain = "./" + pymain
subprocess.call(pymain)


# compiled by pythran
'''
#pythran export main2()

def sum_digit(a):
    res = 0
    while a > 0:
        res += a % 10
        a //= 10
    return res

def main2():
    stdin = open('/dev/stdin')
    N, A, B = map(int, stdin.readline().split())
    ans = 0
    for i in range(1, N + 1):
        if A <= sum_digit(i) <= B:
            ans += i
    print(ans)
'''

Submission status: Accepted

Solution code:
N, A, B = map(int, input().split())
ans = 0 

for n in range(N + 1): 
    if A <= sum(list(map(int, str(n)))) <= B:
        ans += n
print(ans)

Submission status: Accepted

Solution code:
n, a, b = map(int, input().split())
ans = 0
for i in range(a, n+1):
    x = sum(list(map(int, list(str(i)))))
    if x >= a and x <= b:
        ans += i
print(ans)

Submission status: Accepted

Solution code:
n,a,b = map(int,input().split())
ans = 0

for i in range(n+1):
  if a <= sum(list(map(int,str(i)))) <= b:
    ans += i
    
print(ans)

Submission status: Accepted

Solution code:
N,A,B = map(int,input().split())
ans = 0
for i in range(1,N+1):
    s = str(i)
    S = sum(map(int,list(s)))
    if A <= S <= B:
        ans += i
print(ans)

Submission status: Accepted

Solution code:
n, a, b =map(int, input().split())
#整数w, x, y, z
sum=0
for i in range(1, n+1):
    z=i%10
    y=(i//10)%10
    x=(i//100)%10
    w=(i//1000)%10
    v=(i//10000)
    if a<=v+w+x+y+z<=b:
        sum+=i
print(sum)

Submission status: Accepted

Solution code:
n,a,b=map(int,input().split())
def digitsum(k):
    s=str(k)
    array=list(map(int,s))
    return sum(array)
c=1
ans=0
while n>=c:
    if digitsum(c)>=a and digitsum(c) <=b:
        ans+=c
    c+=1
print(ans)

Submission status: Accepted

Solution code:
X,A,B = map(int,input().split())
list = []
for i in range(X + 1):
    tmp = 0
    for j in range(len(str(i))):
        tmp += int(str(i)[j])
    if A <= tmp <= B:
        list.append(i)

print(sum(list))

Submission status: Accepted

Solution code:

def findsum(n):
    sum = 0 # 各桁の和
    while True:
        q, mod = divmod(n, 10)
        sum += mod
        n = q
        if n == 0:
            break

    return sum

N, A, B = map(int, input().split())

arr = range(1,N+1)

sum = 0 # 条件内の各桁の和の合計
for i in range(N):
    a = findsum(arr[i])

    if A <= a <= B:
        sum += arr[i]

print(sum)

Submission status: Accepted

Solution code:
# Some Sums
# input
N, A, B = map(int, input().split())

# solution
res = sum([n for n, y in zip(range(1, N+1), [sum([int(e) for e in str(x)]) for x in range(1, N+1)]) if y >= A and y <= B])

# output
print(res)

Submission status: Accepted

Solution code:
inputs = list(map(lambda i: int(i), input().split()))
N, A, B = inputs[0], inputs[1], inputs[2]
total_sum = 0

for n in range(N+1):
    n_sum = sum(list(map(lambda m: int(m), list(str(n)))))
    if n_sum in range(A, B+1):
        total_sum += n

print(total_sum)

Submission status: Accepted

Solution code:
n, a, b = map(int, input().split())
ans = 0

for i in range(1, n+1):
    if a <= sum(map(int, list(str(i)))) <= b:
        ans += i
    else:
        continue

print(ans)

Submission status: Accepted

Solution code:
def Findsumofdigits(i):
    c = 0
    while i > 0:
        c = c + i % 10
        i = (i - i % 10)/10
    return c
L = input().split()
N = int(L[0])
A = int(L[1])
B = int(L[2])
count = 0
for value in range(N + 1):
    if Findsumofdigits(value) >= A and Findsumofdigits(value) <= B:
        count = count + value
    else:
        pass
print(count)

Submission status: Accepted

Solution code:
N, A, B = [int(i) for i in input().split()]

def sum_n(n):
    sum = 0
    while n > 0:
        sum += n % 10
        n //= 10
    return sum

ans = 0
for i in range(1, N+1):
    sum = sum_n(i)
    if sum >= A and sum <= B:
        ans += i

print(ans)

Submission status: Accepted

Solution code:
n,a,b = map(int,input().split())
count=0

for i in range(1,n+1):
  sum=0
  t=i
  while t>0:
    sum += t%10
    t = (t-t%10)/10
  
  if a <= sum <= b:
    count += i
  
print(count)

Submission status: Accepted

Solution code:
N, A, B = map(int, input().split())
result = 0

for i in range(N + 1):
    if A <= sum(list(map(int, str(i)))) <= B:
        result = result + i
        
print(result)

Submission status: Accepted

Solution code:
n, a, b = [int(x) for x in input().split()]

sum = 0
for x in range(1, n + 1):
    gyo_sum = 0
    x_str = str(x)
    for y in range(len(x_str)):
        gyo_sum += int(x_str[y])
    if gyo_sum >= a and gyo_sum <= b:
        sum += x

print(sum)

Submission status: Accepted

Solution code:
n, a, b = map(int, input().split())
ans = 0
for i in range(1, n + 1):
    s = 0
    init = i
    while i > 0:
        i, r = divmod(i, 10)
        s += r
    if s >= a and s <= b:
        ans += init
print(ans)

Submission status: Accepted

Solution code:
N,A,B = map(int,input().split())

count = 0

box = []

for x in range(N+1):
    result = sum(list(map(int, str(x))))
    if A<=result & result<=B:
        box.append(x)

print(sum(box))

Submission status: Accepted

Solution code:


def main():

    N,A,B = map(int,input().split())
    ans = 0

    for outer in map(str,range(1,N+1)):
        inner = sum([int(inner) for inner in outer])
        if A<=inner and inner <= B:
            ans += int(outer)

    print(ans)



if __name__== "__main__":
    main()

Submission status: Accepted

Solution code:
N,A,B = map(int,input().split())
count = 0

for i in range(N+1):
    s = sum(map(int,list(str(i))))
    if A <= s and s <= B:
        count += i

print(count)

Submission status: Accepted

Solution code:
N, a, b =map (int, input().split(' '))

res =0
for i in range(1,N+1):
    total =0
    for d in list(str(i)):
        total += int(d)
    
    
    if total >= a and total <= b:
        res += i
            
print(res)

Submission status: Accepted

Solution code:
N,a,b = map(int,input().split())
ans = 0
for i in range(N+1):
    if a <= sum(list(map(int,list(str(i))))) <= b:
        ans += i
print(ans)

Submission status: Accepted

Solution code:
N,A,B = map(int,input().split())
goal = 0

for i in range(1,N+1):
    tmpstr = str(i)
    tmplist = list(tmpstr)
    tmpsum = 0
    for j in tmplist:
        tmpsum += int(j)
    
    if tmpsum >= A and tmpsum <= B:
        goal += i

print(goal)

Submission status: Accepted

Solution code:
a,b,c = map(int,input().split())
y = 0
for num in range(a + 1):
  s = 0
  x = num
  while x > 0:
    s += int(x % 10)
    x = int(x / 10)
  if s >= b and s <= c:
    y += num
print(y)

Submission status: Accepted

Solution code:
n,a,b=map(int,input().split())
print(sum(i for i in range(n+1) if a<=sum(map(int,str(i)))<=b))

Submission status: Accepted

Solution code:
N, A, B = map(int, input().split())
s = 0
for i in range(1,N+1):
  a = i%10
  b = (i//10)%10
  c = (i//100)%10
  d = (i//1000)%10
  e = (i//10000)%10
  f = (a+b+c+d+e)
  if A <= f <= B:
    s += i
print(s)

Submission status: Accepted

Solution code:
def sums(n):
    ans = 0
    while n > 0:
        a = n%10
        n = n//10
        ans += a
    return(ans)

N, A, B = map(int, input().split())
ans = 0
for i in range(1, N+1):
    sum = sums(i)
    if A <= sum <= B:
        ans += i
print(ans)

Submission status: Accepted

Solution code:
from collections import defaultdict, Counter
from heapq import heapify, heappop, heappush
from sys import stdin

def main():
    n, a, b = map(int, input().split())
    ans = 0
    for i in range(1, n+1):
        tmp = i%10 + i//10%10 + i//(10**2)%10 + i//(10**3)%10 + i//(10**4)%10
        if a <= tmp and tmp <= b:
            ans += i
    print(ans)

input = lambda: stdin.readline().rstrip()
main()

Submission status: Accepted

Solution code:
N, A, B = map(int, input().split())
cnt = 0
for i in range(1,N+1):
    s = sum(map(int,list(str(i))))
    if A <= s <= B:
        cnt += i
print(cnt)

Submission status: Accepted

Solution code:
n,a,b=map(int,input().split())
print(sum([i for i in range(1,n+1) if a<=sum(map(int,str(i)))<=b]))

Submission status: Accepted

Solution code:
n, a, b = map(int, input().split())

res = 0
for num in range(1, n + 1):
    s = sum(map(int, list(str(num))))
    if a <= s <= b:
        res += num
print(res)

Submission status: Accepted

Solution code:
n,a,b = map(int,input().split())
L = []
for i in range(1,n+1):
  wa = 0
  for j in range(len(str(i))):
    wa += int(str(i)[j])
  if a<=wa<=b:
    L.append(i)
print(sum(L))

Submission status: Accepted

Solution code:
n,a,b=map(int,input().split())
ans=0
for i in range(n+1):
  ans+=[0,i][a<=sum([int(j) for j in list(str(i))])<=b]
print(ans)

Submission status: Accepted

Solution code:
import math
import numpy as np


#a, b, c, x = map(int, [input() for i in range(4)])
#z = list(map(int, input().split()))
#n, a, b = map(int, input().split())

#print(len(z))
#for i in z:
#    print(i)

n, a, b = map(int,input().split())

ans = 0
for i in range(n+1):
    sum = 0
    k = i
    while k > 0:
        sum += k % 10
        k = k // 10
    if a <= sum <= b:
        ans += i
print(ans)

Submission status: Accepted

Solution code:
n, a, b = map(int, input().split())
total = 0
for i in range(n+1):
    _i = sum(map(int, list(str(i))))
    if a <= _i <= b:
        total += i
print(total)

Submission status: Accepted

Solution code:
n, a, b = map(int, input().split())
l = 0
for j in range(n):
    m = list(str(n-j))
    keta = 0
    for i in m:
        keta += int(i)
    if a <= keta <= b:
        l += n-j
print(l)

Submission status: Accepted

Solution code:
n,a,b = map(int,input().split())

ans=0
for i in range(n+1):

    sum=0
    for i_str in list(str(i)):
        sum+=int(i_str)

    if a<= sum <= b:
        ans += i

print(ans)

Submission status: Accepted

Solution code:
N,A,B = map(int, input().split())
x = 0
for i in range(1,N+1):
  n = sum(list(map(int, str(i))))
  if A <= n <= B:
    x += i

print(x)

Submission status: Accepted

Solution code:
n, a, b = map(int, input().split())
ans = 0
for x in range(n+1):
    tmp = 0
    val = x
    while(x > 0):
        tmp += x % 10
        x //= 10
    if a <= tmp <= b:
        ans += val
print(ans)

Submission status: Accepted

Solution code:
n, a, b = list(map(int, input().split()))
total = 0
for i in range(n+1):
    s = str(i)
    wa = 0
    for j in range(len(s)):
        wa += int(s[j])
    if wa >= a and wa <= b:
        total += i
print(total)

Submission status: Accepted

Solution code:
N,A,B = map(int,input().split())

TRUE_LIST = []

list_1 = list(range(0,N+1))

for i in range(len(list_1)):
  s = str(list_1[i])
  arr = list(map(int,s))
  t=sum(arr)
  if A <= t and t <= B:
    TRUE_LIST.append(list_1[i])

print(sum(TRUE_LIST))

Submission status: Accepted

Solution code:
n, a, b = map(int, input().split())

ans = []
for i in range(n):
    add = sum([int(j) for j in str(i+1)])
    if a <= add <= b:
        ans.append(i+1)
print(sum(ans))

Submission status: Accepted

Solution code:
N, A, B = [int(n) for n in input().split()]

def dismantle(n):
  ans = 0
  while n > 0:
    ans += n % 10
    n //= 10
  return ans

ans = 0
for i in range(N+1):
  comp = dismantle(i)
  if i > 0 and A <= comp and comp <= B:
    ans += i

print(ans)

Submission status: Accepted

Solution code:
N,A,B=map(int,input().split())

ans=0

for i in range(N):
    tmp=0
    number=str(i+1)
    for j in range(len(number)):
        tmp+=int(number[j])
    if A<=tmp<=B:
        ans+=(i+1)

print(str(ans))

Submission status: Accepted

Solution code:
N,A,B = map(int,input().split())
count=0
for n in range(1,N+1):
    sumn=0
    strn = str(n)
    for lenn in range(len(strn)):
        if lenn == 0:
            sumn += n%10
        else:

            sumn += int(n/(10**lenn))%10

    if sumn >= A:
        if sumn <= B:
            count+=n
print(count)

Submission status: Accepted

Solution code:
n,a,b = map(int,input().split())
number = 0
ans = 0
for i in range(1,n+1):
  number = 0
  for j in range(len(str(i))):
    number += int(str(i)[j])
  if number >= a and number <= b:
    ans += i
print(ans)

Submission status: Accepted

Solution code:
def main():
    N, A, B = map(int, input().split())
    ans = 0
    for i in range(1, N+1):
        v = sum([int(c) for c in str(i)])
        if A <= v <= B:
            ans += i
    return ans

if __name__ == '__main__':
    print(main())

Submission status: Accepted

Solution code:
N,a,b = map(int,input().split())

temp = 0   
sum1 = 0
sum2 = 0
for i in range(N):
  temp = i+1
  sum1 = 0          
  while temp != 0:
    sum1 += temp%10
    temp = int(temp/10)
  if sum1 >= a and sum1 <= b:
    sum2 += i+1
    #print(i)

print(sum2)

Submission status: Accepted

Solution code:
N, A, B = [int(x) for x in input().split(' ')]

rtn = 0
for i in range(1,N+1):
  sm = sum([int(x) for x in str(i)])
  if A <= sm and sm <= B:
    rtn += i
print(rtn)

Submission status: Accepted

Solution code:
n,a,b = map(int,input().split())
s = 0
for i in range(n):
    x = sum(list(map(int,str(i+1))))
    if a <= x and x <= b:
        s += i+1
print(s)

Submission status: Accepted

Solution code:
cou = 0
N, A, B = map(int, input().split())
for i in range(1, N + 1):
    tmp = list(str(i))
    if A <= sum(map(int, tmp)) <= B:
        cou += i
print(cou)

Submission status: Accepted

Solution code:
n, a, b = map(int, input().split())

def divide(num):
  sum = 0
  while num > 0:
    sum += num % 10
    num //= 10
  return sum

ans = 0
for i in range(n):
  temp = divide(i+1)
  if temp>= a and temp <= b:
    ans += (i+1)
print(ans)

Submission status: Accepted

Solution code:
N,A,B=map(int,input().split())
s=0

for n in range(0,N+1):
    m=0
    k=n
    while k > 0:
        m += k%10
        k = k//10

    if A<= m <=B:
        s += n

print(s)

Submission status: Accepted

Solution code:
n, a, b = (int(i) for i in input().split())
ans = 0
for i in range(1,n+1):
    cur = i
    cur_sum = 0
    while cur > 0:
        cur_sum += cur%10
        cur //= 10
    if a <= cur_sum <= b:
        ans += i
print(ans)

Submission status: Accepted

Solution code:
n, a, b = map(int, input().split())

sum = 0
for i in range(n + 1):
    sum2 = 0
    j = i
    while j != 0:
        sum2 += j % 10
        j = j // 10
    if sum2 >= a and sum2 <= b:
        sum += i

print(sum)

Submission status: Accepted

Solution code:
n, a, b = map(int, input().split())
ans = 0
for i in range(n+1):
    if a <= sum(list(map(int, list(str(i))))) <= b:
        ans += i
print(ans)

Submission status: Accepted

Solution code:
n, a, b = map(int, input().split())

sum = 0
for i in range(n + 1):
    sum2 = 0
    j = i
    while True:
        if j == 0:
            break
        sum2 += j % 10
        j = j // 10
    if sum2 >= a and sum2 <= b:
        sum += i

print(sum)

Submission status: Accepted

Solution code:
# coding: utf-8
# Your code here!
N,A,B=map(int,input().split())

count=0

for h in range(2):
    for i in range(10):
        for j in range(10):
            for k in range(10):
                for l in range(10):
                
                    if h+i+j+k+l>B:
                        break
                    elif ((h+i+j+k+l)>=A and (10000*h+1000*i+100*j+10*k+l)<=N):
                        count+=10000*h+1000*i+100*j+10*k+l
                        

                    
print(count)

Submission status: Accepted

Solution code:
N, A, B = map(int, input().split())

total = 0
for n in range(1, N + 1):
    tmp = n
    n_sum = 0

    while tmp != 0:
        n_sum += tmp % 10
        tmp //= 10

    if A <= n_sum <= B:
        total += n

print(total)