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())

# 文字列をリストにすると分解できる
# print(list("python")) ['p', 'y', 't', 'h', 'o', 'n']

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:
inputs = input().split()
n, a, b = list(map(int, inputs))
count=0
for num in range(n+1):
    num_str = str(num)
    all = 0
    for i in range(len(num_str)):
       all += int(num_str[i])
    if a <= all <= b:
      count+=num
print(count)

Submission status: Accepted

Solution code:
N, A, B = map(int, input().split())
ans = 0
for i in range(1, N+1):
    N10000 = i // 10000
    N1000 = i // 1000 - N10000 * 10
    N100 = i // 100 - N10000 * 100 - N1000 * 10
    N10 = i // 10 - N10000 * 1000 - N1000 * 100 - N100 * 10
    N1 = i - N10000 * 10000 - N1000 * 1000 - N100 * 100 - N10 * 10
    if A <= N1 + N10 + N100 + N1000 + N10000 <= B:
        ans += i
print(ans)

Submission status: Accepted

Solution code:
N, A, B = input().split()
A = int(A)
B = int(B)
k_sum = 0
ans = 0
for j in range(1, int(N)+1):
  j = str(j)
  k_sum = 0
  for i in range(len(j)):
  	k_sum += int(j[i])
  if k_sum >= A and k_sum <= B:
    ans += int(j)
print(ans)

Submission status: Accepted

Solution code:
# /usr/bin/python
# -*- coding: utf-8 -*-
#
import sys
import math


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


ans = 0
for i in range(1,n+1):
  s = sum(list(map(int, list(str(i)))))
  if a <= s and s <= 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):
    sum=0
    temp=i
    for m in range(5):
        sum+=temp%10
        temp=temp//10
    if A <= sum and sum <= B:
        total+=i

print(total)

Submission status: Accepted

Solution code:
import sys
n, a, b = [int(i) for i in sys.stdin.readline().split()]
total = 0
for i in range(1, n + 1):
    digit_sum = sum([int(i) for i in list(str(i))])
    if a <= digit_sum and digit_sum <= b:
        total += i
print(total)

Submission status: Accepted

Solution code:
n,a,b = map(int, input().split())
ans = 0
for i in range(n+1):
    sum = 0
    ans_i = i
    for j in range(5):
        sum += i % 10
        i = i // 10
    if a <= sum <= b:
        ans += ans_i
print(ans)

Submission status: Accepted

Solution code:
def rank(num):
  if num==10000:
    return 1
  else:
    return(num%10+int(num%100/10)+int(num%1000/100)+int(num%10000/1000))
 
n,a,b = map(int,input().split())
count = 0
 
for i in range(1,n+1):
  if a <= rank(i) <= b:
    count +=i
 
print(count)

Submission status: Accepted

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

for i in range(1, N+1):
    tmp = 0
    num = i

    while 1:
        tmp += num%10
        num = int(num/10)
        if num == 0:
            break

    if A <= tmp <= B:
        sums += i


print(sums)

Submission status: Accepted

Solution code:
#083 B
N,A,B =map(int,input().split())
ans = 0
for i in range(N+1):
    tmp=0

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

Submission status: Accepted

Solution code:
listNAB = input().split()
listNABint = [int(s) for s in listNAB]

def Placesum(x):
    y = str(x)
    counter = 0
    for i in range(len(y)):
        counter += int(y[i])
    return counter

sumcounter = 0
for i in range(listNABint[0]):
    if listNABint[1] <= Placesum(i+1) & Placesum(i+1) <= listNABint[2]:
        sumcounter += i+1
print(sumcounter)

Submission status: Accepted

Solution code:
N,A,B=[int(i) for i in input().split()]
ans=0
for i in range(1,N+1):
    L=len(str(i))
    count=0
    for j in range(L):
        count=count+int(str(i)[j])
    if A<=count<=B:
        ans+=i
    else:
        continue
print(ans)

Submission status: Accepted

Solution code:
N, A, B = [int(m) for m in input().split()]
total = 0
for num in range(1, N + 1):
    sum = 0
    for kurai in str(num):
        sum += int(kurai)
    if A <= sum <= B:
        total += num
print(total)

Submission status: Accepted

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

result = []
for seisu in range(1,n+1):

  wa = 0
  first_seisu = seisu

  while seisu != 0:
    wa = wa + seisu % 10
    seisu = int(seisu/10)

  if a <= wa <= b:
    result.append(first_seisu)

print(sum(result))

Submission status: Accepted

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

result = []
for i in range(1,n+1): # n=20のとき1~20を検査するよ
  i = str(i)
  wa = 0
  for j in range(0,len(str(i))): # strとして認識するために、文字列は配列として0個目の文字列＋1個目の文字列みたいに足し算をしていくよ
    wa = wa + int(i[j])
  if a <= wa <= b:
    result.append(int(i))

print(sum(result))

Submission status: Accepted

Solution code:
N, A, B = [int(i) for i in input().split()]
total = 0
for i in range(1, N+1):
    sum = 0
    for j in str(i):
        sum += int(j)
    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<=eval('+'.join(list(str(i))))<=b]))

Submission status: Accepted

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

import sys
input = sys.stdin.readline

def io_generator():
	return input()

#+++++++++++++++++++

def bbs(v):
	s = [int(ci) for ci in list(str(v))]
	return sum(s)
	
def main(io):
	n, a, b = map(int, io().split())
	return sum([x for x in range(1,n+1) if a<= bbs(x) and bbs(x) <= b])

#++++++++++++++++++++

if __name__ == "__main__":
	io= lambda : io_generator()
	print (main(io))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
N,A,B = map(int, input().split())
def find_sum_of_digit(n):
    sum = 0
    while True:
        sum += n%10
        n = int(n/10)
        if n == 0:
            break
    return sum
ans = 0
for i in range(1,N+1):
    a = find_sum_of_digit(i)
    if a>=A and a<=B:
        ans += i
print(ans)

Submission status: Accepted

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


def sum_digits(n):
    result = 0
    while (n > 0):
        result += n % 10
        n = int(n / 10)
    return result


total = 0
for i in range(1, n + 1):
    sum_d = sum_digits(i)
    total += i if a <= sum_d and sum_d <= b else 0
print(total)

Submission status: Accepted

Solution code:
# ABC083B - Some Sums

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


nums = list(range(1, N+1))
total = 0
for i in nums:
    k = i
    s = 0
    while k:
        k, remainder = divmod(k, 10)
        s += remainder
    if A <= s <= B:
        total += i
print(total)

# sample

##N, A, B = map(int, input().split())
##total = 0
##for i in range(N+1):
##    if A <= sum([int(s) for s in str(i)]) <=b:
##        total += i
##print(total)

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
# Input
list = []
n, a, b = map(int, input().split())

total = 0
for ii in range(1, n + 1):
    sum = 0
    tmp = ii
    while tmp > 0:
        sum += tmp % 10
        tmp = tmp // 10

    if sum >= a and sum <= b:
        total += ii
print(total)

Submission status: Accepted

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

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

print(S)

Submission status: Accepted

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

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

print(answer)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def main(n, a, b):
    target_list = []

    for i in range(1, n+1):
        nums = list(map(int, list(str(i))))
        total = sum(nums)
        if total >= a and total <= b:
            target_list.append(i)

    return sum(target_list)


if __name__ == "__main__":
    n, a, b = list(map(int, input().split()))
    print(main(n, a, b))

Submission status: Accepted

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

for i in range(n+1):
    str_i = str(i)
    sum_i = sum(map(int, str_i))
    if a <= sum_i <= b:
        counter += i

print(counter)

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, str(i)))) <= b:
		ans = ans + i
print(ans)

Submission status: Accepted

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

ans = 0
for n in range(1, N+1):
  s = 0
  N = n
  while n>0:
    s += n%10
    n //= 10
  if A <= s <= 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):
    x = 0
    y = i
    while y>0:
        x += y%10
        y //=10
    if a <= x <= b:
        ans += i

print(ans)

Submission status: Accepted

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

res = []
for i in range(1,N + 1):
    if A <= sum(map(int,list(str(i)))) <= B:
        res.append(i)

print(sum(res))

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 and tmp <= 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):
    i_str = list(str(i))
    # print(i_str)
    num_sum = 0
    for num_str in i_str:
        num_sum += int(num_str)
    if num_sum >= a and num_sum <= b:
        sum += i
print(sum)

Submission status: Accepted

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

for n in range(1, N+1):
    n = str(n)
    for i in range(len(n)):
        C += int(n[i])
    if A <= C and C <= B:
        ans += int(n)
    C = 0

print(ans)

Submission status: Accepted

Solution code:
res = 0

N, A, B = map(int, input().split())
for i in range(1, N + 1):
    if A <= sum(int(j) for j in str(i)) <= B:
        res += i

print(res)

Submission status: Accepted

Solution code:
N, A, B = list(map(int, input().split()))
ans = 0
for n in range(1, N+1):
  if A <= sum(list(map(int, list(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(n+1):
	kurai = sum(map(int,list(str(i))))
	if kurai >= a and kurai <= 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):
    letter_list = []
    for letter in str(i):
        letter_list.append(letter)
    num_list = list(map(int, letter_list))

    if a <= sum(num_list) <= b:
        total += i

print(total)

Submission status: Accepted

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

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())
ans = 0
for i in range(1, n + 1):
  total = 0
  j = i
  while (i > 0):
    total += i % 10
    i = i//10
  if (a <= total and total <= b ):
    ans += j

print(ans)

Submission status: Accepted

Solution code:
li = input().split()
N = int(li[0])
A = int(li[1])
B = int(li[2])
ans = 0
for i in range(N + 1):
  t = list(str(i))
  s = 0
  for j in t:
    s += int(j)
  if B>= s:
    if s >= A:
      ans += i
print(ans)

Submission status: Accepted

Solution code:
N, A, B = map(int, input().rstrip().split())
total = 0
for i in range(1,N+1):
    answer = 0
    tmp = i
    while True:
        answer += i % 10
        i = i//10
        if i == 0:
            break
    if answer >= A and answer <= B:
        total += tmp
print(total)

Submission status: Accepted

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

res = 0

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

Submission status: Accepted

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

counter = 0
for n in range(1,N+1):
    strn = str(n)
    sumn = 0
    for i in range(len(strn)):
        sumn += int(strn[i])
    if (sumn >= A ) and (sumn <= B):
        counter += n

print(counter)

Submission status: Accepted

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

Submission status: Accepted

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

Submission status: Accepted

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

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

ans=0
for n in range(1, N+1):
    s = sumEachOrder(n)
    if s >= A and s <= B:
        ans += n
print(ans)

Submission status: Accepted

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

ans = 0
for n in range(1, N+1):
    nl = list(map(int, list(str(n))))
    s = 0
    for i in nl:
        s += i
    if s >= A and s <= B:
        ans += n
print(ans)

Submission status: Accepted

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

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

def digit_list(num):
    num = str(num)
    num = list(num)
    num = list(map(int,num))
    return num

cnt = 0

for i in range(1,n+1):
    temp = sum(digit_list(i))
    if a <= temp <= b:
        cnt += i

print(cnt)

Submission status: Accepted

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

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

print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

sum = 0
for i in range(n):
  x = (i + 1) // 10000 + (i + 1) % 10000 // 1000 + (i + 1) % 1000 // 100 + (i + 1) % 100 // 10 + (i + 1) % 10
  if a <= x <= b:
    sum += i + 1
print(sum)

Submission status: Accepted

Solution code:
n,a,b=map(int,input().split())
ans=0
for i in range(1,n+1):
  t=i%10+i//10%10+i//100%10+i//1000%10+i//10000
  
  if a<=t<=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):
    num = sum([int(a) for a in str(i)])
    if A <= num <= B:
        ans += i
print(ans)

Submission status: Accepted

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

for num in range(1, n+1):
  bits = list()
  numm = num
  while num > 0:
    tmp = num % 10
    bits.append(tmp)
    num -= tmp
    num /= 10
  if a <= sum(bits) <= b:
    ans += numm

print(ans)

Submission status: Accepted

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

counter = 0
for n in range(N):
  n += 1
  nn = [int(nn) for nn in str(n)]
  nnn = sum(nn)
  if nnn >= A and nnn <= B:
    counter += n
print(counter)

Submission status: Accepted

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

l = []
ans = 0

for i in range(1, n + 1):
    if len(str(i)) == 1 and a <= i <= b:
        l.append(i)
    elif len(str(i)) != 1:
        ans = sum(int(j) for j in str(i))
        if a <= ans <= b:
            l.append(i)
print(sum(l))

Submission status: Accepted

Solution code:
import numpy as np

s = input().rstrip().split(' ')
ans = 0

for i in range(int(s[0])):
    num = str(i+1)
    split_num = np.array(list(num))
    sum_split_num = split_num.astype(int).sum()
    if sum_split_num >= int(s[1]) and sum_split_num <= int(s[2]):
        ans = ans + i+1
print(ans)

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,str(i))) <= b:
    ans+=i
print(ans)

Submission status: Accepted

Solution code:
nab = list(map(int, input().split()))
_ = 0
for i in range(1, nab[0]+1, 1):
    # print("i",i)
    k = str(i)
    sum_k = 0
    k_len = len(k)
    for j in k:
        sum_k += int(j)
    # print("sum_k",sum_k)
    if nab[1] <= sum_k <= nab[2]:
        _ += i

print(_)

Submission status: Accepted

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

for i in range(1,N+1):
  d_i = i % 10
  c_i = ((i - d_i) % 100) / 10
  b_i = ((i - c_i * 10 - d_i) % 1000) / 100
  a_i = ((i - b_i * 100 - c_i * 10 - d_i) % 10000) / 1000
  if i == 10000:
    e_i = 1
  else:
    e_i = 0
  sum_i = a_i + b_i + c_i + d_i + e_i
  if A <= sum_i and sum_i <= B:
    count = count + i
    
print(count)

Submission status: Accepted

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

def f(n):
    ret=0
    while n>0:
        ret+=n%10
        n//=10
    return ret

s=0
for i in range(1,N+1):
    if A<=f(i)<=B:
        s+=i
print(s)

Submission status: Accepted

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

for i in range(n + 1):
  n_list = [int(j) for j in list(str(i))]
  keta_sum = sum(n_list)
  if a <= keta_sum and keta_sum <= b:
    result.append(i)
  else:
    pass
print(sum(result))

Submission status: Accepted

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

Submission status: Accepted

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

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

print(ans)

Submission status: Accepted

Solution code:
#coding:utf-8

N, A, B = (int(x) for x in input().split())
ans = 0


for i in range(N+1):
	digit = [int(s) for s in list(str(i))]
	temp = sum(digit)
	if A <= temp <= B:
		ans+= i
		
print(ans)

Submission status: Accepted

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

sums = [sum(
            [int(c) for c in str(i)]
        )
        for i in range(1, N+1)]
sums = [n for n, s in zip(range(1, N+1), sums) if A <= s <= B]
#print(sums)
print(sum(sums))

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 = (int(x) for x in input().split())

sum = 0
for a in range(N+1):
  
  a = str(a)
  a_list = list(a)
  a_list_i = [int(a) for a in a_list]

  a_list_i_sum = 0
  for b in a_list_i:
    a_list_i_sum = a_list_i_sum + b
  if a_list_i_sum >=A and a_list_i_sum <= B:
    sum = sum + int(a)

print(sum)

Submission status: Accepted

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

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

Submission status: Accepted

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

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

print(ans)

Submission status: Accepted

Solution code:
#!usr/bin/env python3
from collections import defaultdict
from collections import deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
def LI(): return list(map(int, sys.stdin.readline().split()))
def I(): return int(sys.stdin.readline())
def LS():return list(map(list, sys.stdin.readline().split()))
def S(): return list(sys.stdin.readline())[:-1]
def IR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = I()
    return l
def LIR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = LI()
    return l
def SR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = S()
    return l
def LSR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = SR()
    return l
mod = 1000000007

#A
def A():
    a,b,c,d = LI()
    if a+b > c+d:
        print("Left")
    elif a+b == c+d:
        print("Balanced")
    else:
        print("Right")
    return

#B
def B():
    def digit_sum(n):
        res = 0
        m = n
        while m:
            res += m%10
            m//=10
        return res
    n,a,b = LI()
    ans = 0
    for i in range(1,n+1):
        if a <= digit_sum(i) <= b:
            ans += i
    print(ans)
    return

#C
def C():
    x,y = LI()
    ans = 1
    for i in range(10000000000000):
        x *= 2
        if x > y:break
        ans += 1
    print(ans)

#D
def D():
    s = S()
    n = len(s)
    ans = n
    for i in range(n-1):
        if s[i] != s[i+1]:
            ans = min(ans,max(i+1,n-i-1))
    print(ans)

#E
def E():
    return

#F
def F():
    return

#G
def G():
    return

#H
def H():
    return

#Solve
if __name__ == "__main__":
    B()

Submission status: Accepted

Solution code:
n,a,b = map(int, input().split())
ans = 0
for i in range(n+1):
    l = sum(list(map(int, list(str(i)))))
    if a <= l <= 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 = 0
  for j in range(len(str(i))):
    s += int(str(i)[j])
  if A <= 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):
    Nlist = list(map(lambda x : int(x), str(i)))
    if sum(Nlist) >= A and sum(Nlist) <= B:
        ans += i
print(ans)

Submission status: Accepted

Solution code:
N,A,B = map(int,input().split())
list_N = list(range(1,N+1))
result = []
for i in range(N):
    cnt = 0
    tmp = 0
    tmp = str(list_N[i])
    tmp_len = len(tmp)
    for j in range(tmp_len):
            cnt += int(tmp[j])
    if A <= cnt and B >= cnt:
        result.append(tmp)    
    else:
        continue
print(sum(list(map(int,result))))

Submission status: Accepted

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

Submission status: Accepted

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

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

answer = 0

for i in range(n+1):
    nc = list(str(i))
    nc = list(map(int,nc))
    ncsum = sum(nc)
    nc = list(map(str,nc))
    nc = int("".join(nc))
    if a <= ncsum and b >= ncsum:
        answer += nc

print(answer)

Submission status: Accepted

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

for i in range(1, N+1):
    sum = 0
    for j in range(len(str(i))):
        sum += int(str(i)[j])
    if a <= 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):
    x = sum([int(c) for c in str(i)])
    if A <= x and x <= B:
        count += i

print(count)

Submission status: Accepted

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

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())

ans = 0
for i in range(1, N + 1):
    original_i = i
    s = 0
    while i != 0:
        s += i % 10
        i //= 10
    if A <= s <= B:
        ans += original_i
print(ans)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def wa(n,a,b):
  hoge=0
  ans=0
  for i in range(1,n+1):
    s=str(i)
    hoge=0
    for ii in s:
      hoge+=int(ii)
    if a<=hoge<=b:
      ans+=i
  return ans
n,a,b=map(int,input().split())
print(wa(n,a,b))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
from sys import stdin
n, a, b = [int(_) for _ in stdin.readline().rstrip().split()]
ans=[]
for i in range(1,n+1):
    if a <= sum(list(map(int, list(str(i))))) <= b:
        ans.append(i)
print(sum(ans))

Submission status: Accepted

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


n, a, b = map(int, input().split())
s = [0]*5
ans = 0
for i in range(n+1):
    temp = sum_digits(i)
    if a <= temp and temp <= b:
        ans += i
print(ans)

Submission status: Accepted

Solution code:
n, a, b = map(int, input().split())
s = [0]*5
ans = 0
for i in range(n+1):
    s[0] = i // 10000
    s[1] = (i % 10000) // 1000
    s[2] = (i % 1000) // 100
    s[3] = (i % 100) // 10
    s[4] = (i % 10) // 1
    temp = s[0]*10000+s[1]*1000+s[2]*100+s[3]*10+s[4]

    if a <= sum(s) and sum(s) <= b:
        ans += temp
print(ans)

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
print(ans)

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
print(ans)

Submission status: Accepted

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

for i in range(N+1):
  c = 0
  j = i
  while j > 0:
    c += j%10
    j //= 10
  if A <= c <= B:
    result += i
print(result)

Submission status: Accepted

Solution code:
def digits(x):
    ans = 0
    for i in range(4,-1,-1):
        ans += x//(10**i)
        x = x - ((10**i)*(x//(10**i)))
    return ans

[N,A,B] = list(map(int,input().split()))
data = []
for i in range(1,N+1):
    if A <= digits(i) <= B:
        data.append(i)

print(sum(data))

Submission status: Accepted

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

Submission status: Accepted

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


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

count = 0

for i in range(1, n + 1):
    if a <= sum(int(j) for j in str(i)) <= b:
        count += i

print(count)

Submission status: Accepted

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

count=0
for i in range(1,n+1):
  if a<=sum(int(j) for j in str(i))<=b:
    count+=i

print(count)

Submission status: Accepted

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

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

Submission status: Accepted

Solution code:
#83
n, a, b = map(int, input().split())
ans = 0
for i in range(1, n+1):
    sum = 0
    temp = i
    while(temp>0):
        sum += temp%10
        temp = temp//10
    if(a<=sum and sum <= b):
        ans += i
print(ans)

Submission status: Accepted

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

Submission status: Accepted

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

ans = 0
for i in range(1, n+1):
  tmp = sum(int(c) for c in str(i)) 
  if (tmp >= a and tmp <= b):
    ans += i
  
print(ans)

Submission status: Accepted

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

sum_n = 0
for n in range(1, N+1):
    total = 0
    q = n
    while True:
        q, mod = divmod(q, 10)
        total += mod
        if q == 0:
            break
    if A <= total and total <= B:
        sum_n += n
    
print(sum_n)

Submission status: Accepted

Solution code:
# -*- coding: utf-8 -*-
strList = list(map(int, input().split()))

N = strList[0]
A = strList[1]
B = strList[2]

outValue = 0
for n in range(N+1):
    strList = [int(c) for c in str(n)]
    if A <= sum(strList) <= B:
        outValue += n

print(outValue)

Submission status: Accepted

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

count = 0

for i in range(1,N+1):
    n = i
    a = 0
    while n!=0:
        a += n%10
        n = n//10
    if A<=a and a<=B:
        count+=i
print(count)

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def solve(string):
    n, a, b = map(int, string.split())

    def check(i):
        return a <= sum([int(_i) for _i in str(i)]) <= b

    return str(sum([i for i in range(n + 1) if check(i)]))


if __name__ == '__main__':
    print(solve(input()))

Submission status: Accepted

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

Submission status: Accepted

Solution code:
def dsum(x):
  ans,str_x=0,str(x)
  for i in range(len(str_x)):ans+=int(str_x[i])
  return ans
n,a,b=map(int,input().split())
ans=0
for i in range(1,n+1):
  if a<=dsum(i)<=b:ans+=i
print(ans)

Submission status: Accepted

Solution code:
inputArr = input().split(" ")
n = int(inputArr[0])
a = int(inputArr[1])
b = int(inputArr[2])

counter = 0
result = 0
for num in range(n + 1):
  numStr = str(num)
  sum = 0
  for i in range(len(numStr)):
    sum += int(numStr[i])
  if a <= sum and sum <= b:
    result += num
    
print(result)

Submission status: Accepted

Solution code:
def gusaku():
    """
    """
    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)

gusaku()

Submission status: Accepted

Solution code:
N, A, B = map(int, input().split())
count = 0
for n in range(1, N+1):
    n_str = str(n).zfill(4)
    tmp_sum = int(n_str[0])+int(n_str[1])+int(n_str[2])+int(n_str[3])
    if A <= tmp_sum and tmp_sum <= B:
        count += n
    else:
        continue
print(count)