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:
n,a,b = map(int,input().split())
nums = []
for i in range(1,n+1):
  summ = sum(list(map(int,str(i))))
  if a <= summ <= b:
    nums.append(i)
print(sum(nums))

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

for i in range(1, N+1):
  num = str(i)
  sum = 0
  for j in range(len(num)):
    sum += int(num[j])
  
  if A <= sum <= 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):
    s = str(i)
    i_list = list(map(int, s))
    if sum(i_list) >= a and sum(i_list) <= 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):
    istr = map(int, list(str(i)))
    if a <= sum(istr) <= b:
        ans = 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 = list(map(int,list(str(i))))
  if a <= sum(s) <= b:
    ans += i
print(ans)

Submission status: Accepted

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

allsum = 0

for i in range(1,n+1):
  l = list(str(i))
  li = [int(s) for s in l]
  tmpsum = sum(li)
  #for s in range(0,len(l)):
  #  print(s)
  if ((tmpsum >= a) and (tmpsum <= b)):
    allsum = allsum + i
print(allsum)

Submission status: Accepted

Solution code:
n,a,b = map(int, input().split())
ans = 0
for i in range(1,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())
 
s = 0
for i in range(n+1):
  digitsum = i%10 + (i//10)%10 + (i//100)%10 + (i//1000)%10 + (i//10000)%10
  if a <= digitsum <= b:
    s += i
    
print(s)

Submission status: Accepted

Solution code:
n, r_from, r_to = [int(v) for v in input().split(' ')]
ans = 0
for nn in range(1, n + 1):
  ad_digit = 0
  tmp = nn
  while True:
    ad_digit += tmp % 10
    tmp = tmp // 10
    if tmp == 0:
      break
  if r_from <= ad_digit and ad_digit <= r_to:
  	ans += nn
    
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([int(x) for x in str(i)]) <= b:
    ans += i
print(ans)

Submission status: Accepted

Solution code:
N,A,B = map(int, input().split())
tot=0
for i in range(1,N+1):
    i_s = str(i)
    keta_sum = 0
    for j in range(len(i_s)):
        keta_sum+=int(i_s[j])
    if (A<=keta_sum)&(keta_sum<=B):
        tot+=i
print(tot)

Submission status: Accepted

Solution code:
N,A,B=map(int,input().split())
ans=0
def FindSumOfDigits(x):
  count=0
  while x>0:
    count+=x%10
    x=x//10
  return count

for n in range(1,N+1):
  count=FindSumOfDigits(n)
  if A<=count<=B:
    ans+=n
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)
    total = sum([int(i) for i in s])
    if a <= total <= b:
        ans += i 
    
print(ans)

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
# B - Some Sums
# 標準入力の取得
N,A,B = list(map(int, input().split()))

# 1～Nまで全探索
answer = 0
for n in range(1, N+1):
    digit_sum = sum(list(map(int, str(n))))
    if A <= digit_sum and digit_sum <= B:
        answer += n

# 結果出力
print(answer)

Submission status: Accepted

Solution code:
n, a, b = map(int, input().split())
ans_array = []
for i in range(1, n + 1):
    s = str(i)
    array = list(map(int, s))
    sum_array = sum(array)
    if sum_array >= a and sum_array <= b:
        ans_array.append(i)
print(sum(ans_array))

Submission status: Accepted

Solution code:
n,a,b=map(int,input().split())
ans=0
for i in range(1,n+1):
    im=i
    count=[]
    for j in range(37):
        count.append(i%10)
        i=i//10
    csum=sum(count)
    if a<=csum and csum<=b:
        #print(csum)
        ans+=im
print(ans)

Submission status: Accepted

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

result = 0

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

print(result)

Submission status: Accepted

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

for i in range(N):
  n = str(i+1)
  m = sum(map(int, n))
  if A <= m and m <= B:
      Y = Y+i+1
    

print(Y)

Submission status: Accepted

Solution code:

n, x, y = map(int, input().split())
ans = 0

for i in range(1, n + 1):
    s = sum(map(int, list(str(i))))
    if x <= s <= y:
        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=0
    j=i
    while j!=0:
        s+=(j%10)
        j//=10
    if a<=s<=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):
  j=i
  t=0
  while(i//10>=0and i>0):
    t+=i%10
    i=i//10
  if(t>=a and t<=b):
    count+=j
    
print(count)

Submission status: Accepted

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

Submission status: Accepted

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

def digsum(n):
    total = 0
    while n > 0:
        total += n%10
        n /= 10
        n = int(n)
    return total

ans = 0
for i in range(1, N+1):
    if A <= digsum(i) <= 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(n+1):
        i = str(i)
        i_str = i
        i = sum(list(map(int, list(i))))
        if a <= i and i <= b:
            ans += int(i_str)
    print(ans)


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
"""
Created on Sat Mar 21 13:58:43 2020

@author: 藤原聖士
"""

"""
N=int(input())
A=int(input())
B=int(input())
"""

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

check=0
checks=0
count=0

for i in range(N):
    checks=0
    Ns=i+1
    while True:
        
        check=Ns%10
        checks+=check
        Ns=int(Ns/10)

        if Ns==0:
            break
    if checks>= A and checks<=B:
        count+=i+1
        #print(i)

print(count)

Submission status: Accepted

Solution code:
m = input().split()
N = int(m[0])
A = int(m[1])
B = int(m[2])
sum = 0

for n in range(N + 1):
  y = 0
  s = n
  while s > 0:
    y += s % 10
    s = s // 10

  if (y >= A) and (y <= B):
    sum += n

print(sum)

Submission status: Accepted

Solution code:
n,a,b = map(int,input().split())
ans = 0
for i in range(1,n+1):
    s = [int(n) for n in list(str(i))]
    if a<=sum(s)<=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):
    k = i
    p = 0
    while k > 0:
        p += k % 10
        k //= 10
    if A <= p <= 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):
    c=list(str(i))
    d=0
    for g in c:
        d+=int(g)
    if a<=d and d<=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):
    temp = 0
    for j in str(i):
        temp += int(j)
    if a <= temp <=b:
        ans += i

print(ans)

Submission status: Accepted

Solution code:
N,A,B = map(int, input().split())
L = []
for i in range(1,N+1):
    original = i
    s = 0
    while i != 0:
        s += i % 10
        i = i // 10
    if A <= s <= B:
        L.append(original)
print(sum(L))

Submission status: Accepted

Solution code:
N,A,B=map(int,input().split())
ans=0
for i in range(N+1):
  if A<=sum(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):
    j=str(i)
    su=0
    for k in j:
        su+=ord(k)-ord('0')
    if su>=a and su<=b:
        ans+=i
print(ans)

Submission status: Accepted

Solution code:
a = list(map(int, input().split()))
c = []
for i in range(a[0]+1):
    b = sum(list(map(int, str(i))))
    if b >= a[1] and b <= a[2]:
        c.append(i)
print(sum(c))

Submission status: Accepted

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

total = 0
for i in range(n+1):
    wa = sum((map(int, str(i))))
    if a <= wa and wa <= b:
        total += i
print(total)

Submission status: Accepted

Solution code:
import sys
input=sys.stdin.readline

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

for i in range(1,N+1):
	wa=0
	for j in str(i):
		wa+=int(j)
	if A<=wa<=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):
    k = sum( map(int, str(i)))

    if k <= b and k >= a:
        ans += i

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

ans = 0
for i in range(n+1):
    j = i
    k = 0
    while j != 0:
        k += j % 10
        j //= 10

    if k <= b and k >= a:
        ans += i

print(ans)

Submission status: Accepted

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

ans = 0
for i in range(n+1):
    i = str(i)
    k = 0
    for j in range(len(i)):
        k += int(i[j])
    if k <= b and k >= a:
        ans += int(i)

print(ans)

Submission status: Accepted

Solution code:
n,a,b=map(int,input().split())
sum=0
for i in range(n+1):
    x=i
    sum2=0
    while x!=0:
        sum2+=x%10
        x=x//10
    if a<=sum2<=b:
        sum+=i
print(sum)

Submission status: Accepted

Solution code:
def main():
    N, A, B = (int(x) for x in input().split())
    total = 0
    for i in range(1, N+1):
        a = [int(x) for x in str(i)]
        if A <= sum(a) <= B:
            total += i
    print(total)

if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
N, A, B = map(int, input().split())
ans = 0
for i in range(1, N+1):
  sum = 0
  k = i
  while k > 0:
    sum = sum + k % 10
    k = k // 10
  if A <= sum <= B:
    ans = 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, list(str(i))))) <= b:
    ans += i
print(ans)

Submission status: Accepted

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

Num = 0
for i in range(1, N+1):
    List = [int(a) for a in list(str(i))]
    if A <= sum(List) <= B:
        Num += i

print(Num)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
import sys
from math import sqrt
from collections import Counter

input = sys.stdin.readline


def I():
    return int(input())


def MI():
    return map(int, input().split())


def LI():
    return list(MI())


inf = float("inf")
mod = 10 ** 9 + 7


def main():
    num, a, b = MI()

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


if __name__ == "__main__":
    main()

Submission status: Accepted

Solution code:
import math

nab_list = [int(num) for num in list(input().split(" "))]
n = nab_list[0]
a = nab_list[1]
b = nab_list[2]

all_sum = 0
for i in range(1,n+1):
    digit_sum = 0
    num = i
    while(num>0):
        digit_sum+=num%10
        num = math.floor(num/10)
    if a <= digit_sum and digit_sum <= b:
        all_sum += i
print(all_sum)

Submission status: Accepted

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

Submission status: Accepted

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

ans = 0

def judge(number):
    number_str = str(number)
    list_a = []
    for i in number_str:
        list_a.append(int(i))
    list_sum = sum(list_a)
    return list_sum

for i in range(1,N+1):
    if A <= judge(i) <= B:
        ans += i

print(ans)

Submission status: Accepted

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

def keta(n):
    s=0
    while(n>0):
        s+=n%10
        n=n//10
    return s

ans=0
for i in range(a,n+1):
    if(a<=keta(i)&keta(i)<=b):
        ans+=i

print(ans)

Submission status: Accepted

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

sum2=0
for i in range(1,n+1):
    sum1=0
    c=0
    d=i
    while i>0:
        c=i%10
        sum1+=c
        i= i//10
    if sum1>=a and  sum1<=b:
        sum2+=d    
print(sum2)

Submission status: Accepted

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

for i in range(1,N+1):
  S=str(i)
  sum=0
  for num in S:
    sum += int(num)
  if A<=sum and sum<=B:
    ans+= i
    
print(ans)

Submission status: Accepted

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

res = 0
for i in range(1, N+1):
  y = i//10000 + (i%10000)//1000 + i%1000//100 + i%100//10 + i%10
  if A <= y <= B:
    res += i

print(res)

Submission status: Accepted

Solution code:
N, A, B = map(int, input().split())
ans = 0
for n in range(1, N+1):
  sum = 0
  k = n
  while k > 0:
    sum += k % 10
    k //= 10
  if A <= sum <= B:
    ans += n
print(ans)

Submission status: Accepted

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

def get_sum(n):
    ans = 0
    while True:
        ans += n % 10
        if n // 10 > 0:
            n = n // 10
        else:
            break
    return ans

total = 0
for i in range(1, N + 1):
    ans = get_sum(i)
    if A <= ans <= B:
        total += i
print(total)

Submission status: Accepted

Solution code:
N,A,B = map(int,input().split())
ls = []
for i in range(1,N+1):
    i_sum = sum([int(s) for s in list(str(i))])
    if i_sum >= A and i_sum <= B:
        ls.append(i)
print(sum(ls))

Submission status: Accepted

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

ans = 0

for i in range(N+1):
    wa = 0
    for k in range(len(str(i))):
        wa += int(str(i)[k])
    if A <= wa <= 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)
  if a <= sum(list(map(int,s))) <= b:
    ans += i
   
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

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

print(total)

Submission status: Accepted

Solution code:
N,A,B=map(int, input().split())
def sumofdigits(N):
    return sum(map(int, list(str(N))))
print(sum([i for i in range(N+1) if (sumofdigits(i) >= A) and  (sumofdigits(i) <= B)]))

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:
import math
import string


def readints():
    return list(map(int, input().split()))


def nCr(n, r):
    return math.factorial(n)//(math.factorial(n-r)*math.factorial(r))


def has_duplicates2(seq):
    seen = []
    for item in seq:
        if not(item in seen):
            seen.append(item)
    return len(seq) != len(seen)


def divisor(n):
    divisor = []
    for i in range(1, n+1):
        if n % i == 0:
            divisor.append(i)
    return divisor


# coordinates
dx = [-1, -1, -1, 0, 0, 1, 1, 1]
dy = [-1, 0, 1, -1, 1, -1, 0, 1]

n, a, b = map(int, input().split())
sum = 0
sumsum = 0
for i in range(1, n+1):
    x = str(i)
    sum = 0
    for j in range(len(x)):
        sum += int(x[j])

    if a <= sum and sum <= b:
        sumsum += i
print(sumsum)

Submission status: Accepted

Solution code:
N, A, B = map(int, input().split())
ans = 0
for num in range(1, N+1):
    s = sum(ord(c) - ord('0') for c in str(num))
    if A <= s and s <= B: ans += num
print(ans)

Submission status: Accepted

Solution code:
N, A, B = map(int, input().split())
sumS = 0
for x in range(1, N + 1, 1):
    count = 0
    S = str(x)
    for y in range(len(str(x))):
        count += int(S[y])
    if count >= A and count <= B:
        sumS += x
print(sumS)

Submission status: Accepted

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

for i in range(1, N+1):
  temp = list(str(i))
  kurai = [int(x) for x in temp]
  if sum(kurai) >= A and sum(kurai) <= B:
    total += i

print(total)

Submission status: Accepted

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

s = 0
for i in range(1, N + 1):
    tmp = 0
    for k in str(i):
        tmp += int(k)    
    if A <= tmp and tmp <= B:
        s += i
print(s)

Submission status: Accepted

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

count = 0

for number in range(n+1):
  string = str(number)
  total = sum([int(i) for i in string])
  if a <= total <= b:
    count += number
print(count)

Submission status: Accepted

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

cnt=0
for i in range(1,n+1):
  ss=str(i)
  x=0
  for s in ss:
    x+=int(s)
  if x>=a and x <= b:
    cnt+=i
    
print(cnt)

Submission status: Accepted

Solution code:
n,a,b=map(int,input().split())
m=[str(i+1) for i in range(n)]
o=[0 for i in range(n)]
tmp=0
def ad(t):
  tmp=0
  for i in t:
    tmp+=int(i)
  return tmp

for i in range(n):
  o[i]=ad(m[i])
for i in range(n):
  if o[i]>=a and o[i]<=b:
    tmp+=int(m[i])

print(tmp)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

Submission status: Accepted

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

s=0

for num in range(1,N+1):
    c=sum([int(x) for x in str(num)])
    if A<=c<=B:
        s+=num
        
print(s)

Submission status: Accepted

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

result = 0

for i in range(1, n+1):
    i_str = str(i)
    s = list(map(int, str(i)))
    wa = sum(s)

    if a <= wa <= b:
        result += i

print(result)

Submission status: Accepted

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

print(ans)

Submission status: Accepted

Solution code:
X,A,B=input().split()
numbers=[]
N=int(X)
 
def digitsum(n):
    s=str(n)
    array=list(map(int,s))
    return sum(array)
 
 
 
for num in range(1,N+1):
    if int(A)<=int(digitsum(num)) and int(digitsum(num))<=int(B):
        numbers.append(num)
    else:
        continue
 
print(sum(numbers))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def sum_digits(num: int) -> int:
    sum = 0
    while num > 0:
        num, mod = divmod(num, 10)
        sum += mod
    return sum


n, a, b = list(map(int, input().split(' ')))
total = 0
for i in range(1, n + 1):
    sum = sum_digits(i)
    if a <= sum <= b:
        total += i

print(total)

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=list(map(int,input().split()))
s=0
for i in range(1,n+1):
    d=sum(list(map(int,list(str(i)))))
    if d>=a and d<=b:
        s+=i
print(s)

Submission status: Accepted

Solution code:
n,a,b = map(int, input().split())
cnt = 0
for i in range(0,n+1):
    c = list(map(int, str(i)))
    if a <= sum(c) <= 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())
keta, ans = 0, 0
for i in range(1, N+1):
  keta, tmp = 0, i
  while tmp // 10 > 0:
    keta += tmp % 10
    tmp = tmp // 10
  keta += tmp
  if A <= keta <= 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):
    u = sum(list(map(int, str(i))))
    if A <= u <= B:
        ans += i
print(ans)

Submission status: Accepted

Solution code:
def findSumOfDigits(n):
    sum = 0
    while n > 0:
        sum += n%10
        n //= 10
    return sum

def main():
    N, A, B = map(int, input().split())
    sum = 0
    for i in range(1, N+1):
        tmp = findSumOfDigits(i)
        if A <= tmp <= B:
            sum += i

    print(sum)

    return 0


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
import math


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

    total = 0
    for i in range(1, n + 1):
        keta_total = 0
        temp = i
        for waru in [10000, 1000, 100, 10, 1]:
            keta_total += temp // waru
            temp = temp % waru

        if a<= keta_total <= b:
            total += i

    print(total)


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
n,a,b = map(int, input().split())
x = []
for i in range(1, n+1):
    y = 0
    y += i//10000
    y += (i%10000)//1000
    y += (i%1000)//100
    y += (i%100)//10
    y += i%10
    if(a <= y <= b):
        x.append(i)

print(sum(x))

Submission status: Accepted

Solution code:
#各桁の合計値を計算する
def digitSum(n):
    s = str(n)
    #一文字ずつ数値化し配列にする
    array = list(map(int, s))
    return sum(array)

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

for i in range(0,n+1):
    if a<=digitSum(i) and digitSum(i)<=b:
        l.append(i)

print(sum(l))

Submission status: Accepted

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

Submission status: Accepted

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

# 各桁の和を計算する関数
def sumOfDigits(n):
    sum = 0
    while n > 0:
        sum += n % 10
        n = n // 10
    return sum

for i in range(1, N + 1, 1):
    j = sumOfDigits(i)
    if A <= j and j <= B:
        total += i

print(total)

Submission status: Accepted

Solution code:
N, A, B = map(int, input().split())
total = 0
for i in range(1, N + 1, 1):
    i_sum = 0
    for j in range(len(str(i))):
        i_sum += int(str(i)[j])
    # print("i_sum", i_sum)
    if A <= i_sum and i_sum <= B:
        total += i

print(total)

Submission status: Accepted

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

ret = 0
for n in range(1, N+1):
    nums = [int(num) for num in str(n)]
    total = sum(nums)
    if A<=total and total<=B:
        ret += n

print(ret)

Submission status: Accepted

Solution code:
list = input().split(" ")
N = int(list[0])
A = int(list[1])
B = int(list[2])

t = 0
for i in range(1,N+1):
    num = len(str(i))
    sum = 0
    for j in range(num):
        sum = sum + int(str(i)[j])
    if (A <= sum) and (sum <= B):
        t = t + i
print(t)

Submission status: Accepted

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

def ketawa(x):
  temp = x
  res = 0
  while temp != 0:
    res += temp % 10
    temp = temp // 10
  return res

sum = 0

for i in range(1, n+1):
  res = ketawa(i)
  if a <= res <= b:
    sum = sum + i

print(sum)

Submission status: Accepted

Solution code:
n, min_num, max_num = [int(x) for x in input().split()]
xs = range(1, n + 1)

def digit_sum(x):
  return sum([int(d) for d in str(x)])
answers = [x for x in xs if min_num <= digit_sum(x) <= max_num]

print(sum(answers))

Submission status: Accepted

Solution code:
# coding:utf-8
def main():
    n,a,b = map(int, input().split())

    #総和
    count = 0

    for number in range(1,n+1):
        #各桁の合計値
        score = sum(list(map(int, list(str(number))))) 
        if  b >= score >= a:
            count += int(number)
    print(count)


if __name__ == '__main__' :
    main()

Submission status: Accepted

Solution code:
# coding:utf-8
def main():
    n,a,b = map(int, input().split())
    #総和
    count = 0

    for number in range(1,n+1):
        #各桁の合計値
        score = 0
        for loop in str(number):
            loop = int(loop)
            score = score + loop
        if score >= a and score <= b:
            count += int(number)
    print(count)


if __name__ == '__main__' :
    main()

Submission status: Accepted

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

Submission status: Accepted

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

def f(n,a,b):
  count = 0
  
  for i in range(1, n+1):
    if a<=sum(map(int,str(i))) and sum(map(int,str(i)))<=b:
      count += i 
  return count

print(f(N,A,B))

Submission status: Accepted

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

print(sum(list(n for n in range(N+1) if A<=sum(list(int(a) for a in str(n)))<=B)))

Submission status: Accepted

Solution code:
N, A, B = map(int, input().split())
l = []
wa = 0
for i in range(1, N + 1):
    for j in str(i):
        wa += int(j)
        #print(wa)
    if wa >= A and wa <= B:
        l.append(i)
    wa = 0
print(sum(l))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
# Author: cr4zjh0bp
# Created: Thu Mar 12 20:12:47 UTC 2020
import sys
 
stdin = sys.stdin
inf = 1 << 60
mod = 1000000007
 
ni = lambda: int(ns())
nin = lambda y: [ni() for _ in range(y)]
na = lambda: list(map(int, stdin.readline().split()))
nan = lambda y: [na() for _ in range(y)]
nf = lambda: float(ns())
nfn = lambda y: [nf() for _ in range(y)]
nfa = lambda: list(map(float, stdin.readline().split()))
nfan = lambda y: [nfa() for _ in range(y)]
ns = lambda: stdin.readline().rstrip()
nsn = lambda y: [ns() for _ in range(y)]
ncl = lambda y: [list(ns()) for _ in range(y)]
nas = lambda: stdin.readline().split()

N, A, B = na()

def digit_sum(n):
    s = str(n)
    n = 0
    for i in range(len(s)):
        n += int(s[i])
    return n

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

print(ans)

Submission status: Accepted

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

def Nsum(N):
    Ns = str(N)
    return sum(list(map(int,Ns)))

count = 0
for i in range(1,N+1):
    if Nsum(i)>=A and Nsum(i)<=B:
        count += i

print(count)

Submission status: Accepted

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

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

main()

Submission status: Accepted

Solution code:
n, a, b = map(int, input().split())
sums = 0
for i in range(n+1):
    if len(str(i)) != 1:
        nlist = [int(j) for j in str(i)]
        s = 0
        for num in nlist:
            s += num
    else:
        s = int(i)
    if a <= s <= b:
        sums += i
print(sums)

Submission status: Accepted

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

ans = 0
for x in range(n+1):
    amount = sum([int(i) for i in list(str(x))])
    if amount >= a and amount <= b:
        ans += x

print(ans)

Submission status: Accepted

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

count = 0
for i in range(1, n + 1):
    array = list(str(i))
    s = 0
    for j in array:
        s = int(j) + s
    if s >= a and s <= b:
        count = count + i

print(count)

Submission status: Accepted

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

Submission status: Accepted

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


if __name__ == '__main__':
    main()

Submission status: Accepted

Solution code:
def DigitsSUM(Num):
    sumN = 0
    while Num > 0:
        sumN += int(Num) % 10
        Num /= 10
    return int(sumN)


N,A,B = input().split()
LowerLimit=int(A)
UpperLimit=int(B)
num = int(N)
sumary = []
counter = 0
for i in range(1,num+1):
    sumN = DigitsSUM(i)
    
    if LowerLimit <= sumN and sumN <= UpperLimit:
        counter+=int(i)
        
print(counter)

Submission status: Accepted

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

Submission status: Accepted

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

for i in range(1, n+1):
    i_length = len(str(i))
    i_list = list(str(i))
    
    for j in range(i_length):
        i_sum += int(i_list[j])

    if a <= i_sum and i_sum <= b:
        result += i
    i_sum = 0
    
print(result)