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: Wrong Answer

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

for i in range(0,N+1):
    if i < 10:
        if i >= A and i <=B:
            ans_list.append(i)
    else:
        temp = list(map(int,str(i)))
        temp = temp[0]+temp[1]
        if temp >=A and temp<=B:
            ans_list.append(i)
            
print(sum(ans_list))

Submission status: Wrong Answer

Solution code:
s=list(map(int,input().split()))

oklist=[]

def keta(x):
    ketalist=[]
    for j in range(len(x)):
        ketalist.append(int(x[j]))
    return(sum(ketalist))
        
    

for i in range(s[0]+1):
    check=keta(str(i))
    if(s[1]<=check and check<=s[2]):
        oklist.append(i)
        print('ok')       
sum_=sum(oklist)

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

Sum = 0
for i in range(N):
  a = (i+1)//1000
  b = (i+1)%1000//100
  c = (i+1)%100//10
  d = (i+1)%10
  e= a+b+c+d
  if e >= A and e <= B:
    Sum = Sum + (i+1)

print(Sum)

Submission status: Wrong Answer

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

cnt = 0
for n in range(1,N):
    val = n % 10
    tmp = n
    while tmp // 10 > 0:
        tmp = tmp // 10
        val += tmp % 10
    
    if val >= A and val <= B:
        cnt += 1
print(cnt)

Submission status: Wrong Answer

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

cnt = 0
for n in range(1,N):
    val = 0
    tmp = n
    while tmp // 10 > 0:
        val += tmp % 10
        tmp = tmp // 10
    
    if val >= A and val <= B:
        cnt += 1
print(cnt)

Submission status: Wrong Answer

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

cnt = 0
for n in range(1,N):
    val = 0
    tmp = N
    while tmp // N > 0:
        val = tmp % 10
        tmp = tmp // 10
    
    if val >= A and val <= B:
        cnt += 1
print(cnt)

Submission status: Wrong Answer

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

for i in range(1,n+1):
    mod = 0
    while i > 0:
        mod += (i % 10)
        i //= 10
    if mod >= a and mod <= b:
        ans += mod

print(ans)

Submission status: Wrong Answer

Solution code:
N, A, B = 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: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n, a, b = map(int, input().split())
r = 0
for i in range(n + 1):
    c = 0
    j = i
    if j == 10000:
        c += 1
        j -= 10000
    if j >= 1000:
        c += j // 1000
        j -= 1000 * c
    if j >= 100:
        c += j // 100
        j -= 100 * c
    if j >= 10:
        c +=j // 10
        j -= 10 * c
    c += j
    if a <= c and c <= b:
        r += i

print(r)

Submission status: Wrong Answer

Solution code:
n, a, b = map(int, input().split())
r = 0
for i in range(n + 1):
    c = 0
    j = i
    if j >= 1000:
        c += j // 1000
        j -= 1000 * c
    if j >= 100:
        c += j // 100
        j -= 100 * c
    if j >= 10:
        c +=j // 10
        j -= 10 * c
    c += j
    if a <= c and c <= b:
        r += i

print(r)

Submission status: Wrong Answer

Solution code:
from sys import stdin
n, a, b = [int(x) for x in stdin.readline().rstrip().split()]
sum = 0

for x in range(1,n+1):
   l = x // 10000
   m = (x % 10000) // 1000
   n = (x % 1000) // 100
   o = (x % 100) // 10
   p = x % 10
   if l+m+n+o+p >= a and l+m+n+o+p <= b:
      sum += x
   print(l,m,n,o,p,sum)

print(sum)

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

ans=0
for i in range(1,n+1):
  s1=i%10
  s2=(i//10)%10
  s3=((i//10)//10)%10
  s4=((i//10)//10)//10
  if a<=s1+s2+s3+s4<=b:
    ans+=i
print(ans)

Submission status: Wrong Answer

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

ans=0
for i in range(1,n+1):
  s1=i%10
  s2=(i//10)%10
  s3=((i//10)//10)%10
  s4=((i//10)//10)//10
  if a<=s1+s2+s3+s4<=b:
    ans+=i
print(ans)

Submission status: Wrong Answer

Solution code:
a,b,c=input().split()
a=int(a)
b=int(b)
c=int(c)
d=0
for i in range(1,a+1):
  if b<=(i//10000+(i//1000-(i//10000)*10000))+(i//100-(i//1000)*1000)+(i//10-(i//100)*100)+(i//1-(i//10)*10)<=c:
    d=d+i
print(d)

Submission status: Wrong Answer

Solution code:
a,b,c=input().split()
a=int(a)
b=int(b)
c=int(c)
d=0
for i in range(1,a+1):
  if b<=(i//1000+(i//100-(i//1000)*1000))+(i//10-(i//100)*100)+(i//1-(i//10)*10)<=c:
    d=d+i
print(d)

Submission status: Wrong Answer

Solution code:
a,b,c=input().split()
a=int(a)
b=int(b)
c=int(c)
d=0
for i in range(1,a+1):
  if b<=(i//1000+(i-(i//1000)*1000)+i//100+(i-(i//100)*100)+i//10+(i-(i//10)*10))<=c:
    d=d+i
print(d)

Submission status: Wrong Answer

Solution code:
a,b,c=input().split()
a=int(a)
b=int(b)
c=int(c)
d=0
for i in range(1,a):
  if b<=(i//10+(i-(i//10)*10))<=c:
    d=d+i
print(d)

Submission status: Wrong Answer

Solution code:
a,b,c=input().split()
a=int(a)
b=int(b)
c=int(c)
d=0
for i in range(1,a+1):
  if b<=(i//10+(i-(i//10)*10))<=c:
    d=d+i
print(d)

Submission status: Wrong Answer

Solution code:
a,b,c=input().split()
a=int(a)
b=int(b)
c=int(c)
d=0
for i in range(a):
  if b<=(i//10+(i-(i//10)*10))<=c:
    d=d+1
print(d)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
input_line = input()
x, y, z = map(str, input_line.split())

resultNum = 0

for i in range(int(x)):
  loopCnt = len(str(i))
  addNum = 0
  for j in range(loopCnt):
    addNum += int(str(i)[j])
  if int(y) <= addNum <= int(z):
    resultNum += i

print(resultNum)

Submission status: Wrong Answer

Solution code:
input_line = input()
x, y, z = map(str, input_line.split())

print(x, y, z)
resultNum = 0

for i in range(int(x)):
  loopCnt = len(str(i))
  addNum = 0
  for j in range(loopCnt):
    addNum += int(str(i)[j])
  if int(y) <= addNum <= int(z):
    resultNum += i

print(resultNum)

Submission status: Wrong Answer

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

count=0

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

print(count)

Submission status: Wrong Answer

Solution code:
n,a,b = map(int,input().split())
c = 0
for i in range(1,n+1):
    if i < 10:
        x = str(i)
        xsum = int(x[0])
        if xsum >= a and xsum <= b:
            c += i
    elif i >= 10:
        x = str(i)
        xsum = int(x[0]) + int(x[1])
        if xsum >= a and xsum <= b:
            c += i
    elif i >= 100:
        x = str(i)
        xsum = int(x[0]) + int(x[1]) + int(x[2])
        if xsum >= a and xsum <= b:
            c += i
    elif i >= 1000:
        x = str(i)
        xsum = int(x[0]) + int(x[1]) + int(x[2]) + int(x[3])
        if xsum >= a and xsum <= b:
            c += i
    else:
        x = str(i)
        xsum = int(x[0]) + int(x[1]) + int(x[2]) + int(x[3]) + int(x[4])
        if xsum >= a and xsum <= b:
            c += i
print(c)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N,A,B=map(int,input().split())
print(sum([i*(A<=i%9<=B) for i in range(N+1)]))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n, a, b = map(int, input().split())
ans = 0
def digitSum(n):
    # 数値を文字列に変換
    s = str(n)
    # １文字ずつ数値化し配列にする。
    array = list(map(int, s))
    # 合計値を返す
    return sum(array)
for i in range(1, n+1):
    if a <= digitSum(i) <= b:
        ans += digitSum(i)
print(ans)

Submission status: Wrong Answer

Solution code:
n, a, b = map(int, input().split())
ans = 0
for num in range(n):
  sum_digit = sum([int(digit) for digit in str(num)])
  if sum_digit <= a and sum_digit >= b:
    ans += num
print(ans)

Submission status: Wrong Answer

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

list1 = []
for i in range(N+1):
    s = i//1000 + i//100-1000*(i//1000) + i//10-100*(i//100) +  i-10*(i//10)
    if A <= s <= B:
        list1.append(i)

sum = 0
for j in list1:
    sum += j

print(sum)

Submission status: Wrong Answer

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

count = 0

for i in range(n + 1):
    x = i // 10 + i % 10
    if a <= x <= b:
        count += i

print(count)

Submission status: Wrong Answer

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

ans = 0
for i in range(1, n+1):
    s = 0
    for j in range(4):
        m = 10**j
        s += (i // m) % 10
    if a <= s <= b:
        ans += i
print(ans)

Submission status: Wrong Answer

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

ans =0

while N > 0:
    n = N
    t = 0

    while n > 0:
        t += n % 10
        n //= 10

    if A <= t <= B:
        ans += N

    N -= 1

Submission status: Wrong Answer

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

sum = 0

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

Submission status: Wrong Answer

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

ans = 0
for i in range(N+1):
    if i <= 9:
        n = i
    else:
        j = str(i)
        n = int(j[0]) + int(j[1])

    if A <= n and n <= B:
        ans += i

print(ans)

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

Solution code:
N,A,B = map(int,input().split())
a=0
b=0
c=0
d=0
e=0
y=0
for i in range(1,N+1,1):
  n = str(i)
 
  if int(n)==10000:
    e=n[0]
  if 1000<=int(n)<10000:
    d=n[0]
    c=n[1]
    b=n[2]
    a=n[3]
  if 100<=int(n)<1000:
    c=n[0]
    b=n[1]
    a=n[2]
  if 10<=int(n)<100:
    b=n[0]
    a=n[1]
  if int(n)<10:
    a=n[0]
  x = int(d) + int(c) + int(b) + int(a) + int(e)
  if A <= x <= B:
    y = y + int(n)
print(y)

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

def s(sum,a,b):
    t = 0
    if sum >= a and sum <= b:
        t = 1
    return t

def S(i):
    sum = 0
    while i > 0:
        sum += i%10
        i = i/10
    return int(sum)

num = 0
for i in range(1,n+1):
    sum = S(i)
    if s(sum,a,b) == 1:
        num += i
print(num)

Submission status: Wrong Answer

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

def s(sum,a,b):
    t = 0
    if sum >= a and sum <= b:
        t = 1
    return t

num = 0
for i in range(1,n+1):
    sum = int(i/10 + i%10)
    if s(sum,a,b) == 1:
        num += i
print(num)

Submission status: Wrong Answer

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

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

print(ans)

Submission status: Wrong Answer

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

ans = 0
for num in range(n):
  num += 1
  num_0 = num
  place_of_10000 = num//10000
  num -= place_of_10000
  place_of_1000 = num//1000
  num -= 1000*place_of_1000
  place_of_100 = num//100
  num -= 100*place_of_100
  place_of_10 = num//10
  num -= 10*place_of_10
  
  tmp = place_of_10000 + place_of_1000 + place_of_100 + place_of_10 + num
  if a<=tmp and tmp<=b:
    ans += num_0
    
print(ans)

Submission status: Wrong Answer

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

ans = 0
for num in range(n):
  num += 1
  num_0 = num
  place_of_10000 = num//10000
  num -= 10000*place_of_10000
  place_of_1000 = num//1000
  num -= 1000*place_of_1000
  place_of_100 = num//100
  num -= 100*place_of_100
  place_of_10 = num//10
  num -= 10*place_of_10
  
  tmp = place_of_1000 + place_of_100 + place_of_10 + num
  if a<=tmp and tmp<=b:
    ans += num_0
    
print(ans)

Submission status: Wrong Answer

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

ans = 0
for num in range(n):
  num += 1
  num_0 = num
  place_of_1000 = num//1000
  num -= 1000*place_of_1000
  place_of_100 = num//100
  num -= 100*place_of_100
  place_of_10 = num//10
  num -= 10*place_of_10
  
  tmp = place_of_1000 + place_of_100 + place_of_10 + num
  if a<=tmp and tmp<=b:
    ans += num_0
    
print(ans)

Submission status: Wrong Answer

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

count = 0
for i in range(N+1):
    i_4 = int(N/10000)
    res_i = i
    if i_4 != 0:
        res_i = i - i_4*10000
    i_3 = int(res_i/1000)
    if i_3 != 0:
        res_i = res_i - i_3*1000
    i_2 = int(res_i/100)
    if i_2 != 0:
        res_i = res_i - i_2*100
    i_1 = int(res_i/10)
    if i_1 != 0:
        res_i = res_i - i_1*10
    i_0 = res_i
    i_sum = i_4 + i_3 + i_2 + i_1 + i_0

    if i_sum >= A and i_sum <= B:
        count += i

print(count)

Submission status: Wrong Answer

Solution code:
from sys import stdin

n, a, b = [int(x) for x in stdin.readline().rstrip().split()]

s = 0
for i in range(n+1):
    pp = 0
    m = i
    for j in range(4):
        p = m % 10
        pp = pp + p
        m = m//10
    if pp >= a and pp <= b: s = s + i

print (s)

Submission status: Wrong Answer

Solution code:
#

import sys
input=sys.stdin.readline

def main():
    N,A,B=map(int,input().split())
    cnt=0
    for i in range(1,N+1):
        ds=0
        for j in range(4):
            ds+=(int(i//(10**j)))%(10)
        if A<=ds<=B:
            cnt+=i
    print(cnt)
    
if __name__=="__main__":
    main()

Submission status: Wrong Answer

Solution code:
#

import sys
input=sys.stdin.readline

def main():
    N,A,B=map(int,input().split())
    cnt=0
    for i in range(1,N+1):
        ds=0
        for j in range(4):
            ds+=(i//(10**j))%(10)
        if A<=ds<=B:
            cnt+=i
    print(cnt)
    
if __name__=="__main__":
    main()

Submission status: Wrong Answer

Solution code:
#

import sys
input=sys.stdin.readline

def main():
    N,A,B=map(int,input().split())
    cnt=0
    for i in range(1,N+1):
        ds=0
        for j in range(4):
            ds+=(i//(10**j))%(10)
        print(ds)
        if A<=ds<=B:
            cnt+=i
    print(cnt)
    
if __name__=="__main__":
    main()

Submission status: Wrong Answer

Solution code:
#

import sys
input=sys.stdin.readline

def main():
    N,A,B=map(int,input().split())
    cnt=0
    for i in range(1,N+1):
        ds=0
        for j in range(4):
            ds+=(i//(10**j))%(10**j)
        if A<=ds<=B:
            cnt+=i
    print(cnt)
    
if __name__=="__main__":
    main()

Submission status: Wrong Answer

Solution code:
#

import sys
input=sys.stdin.readline

def main():
    N,A,B=map(int,input().split())
    cnt=0
    for i in range(1,N+1):
        ds=0
        for j in range(4):
            ds+=(i//(10**j))%(10**j)
        if A<=ds<=B:
            cnt+=1
    print(cnt)
    
if __name__=="__main__":
    main()

Submission status: Wrong Answer

Solution code:
N,A,B=map(int,input().split())
ans=0
for x in range(1,N+1):
  temp=0
  for y in str(x):
    temp+=int(y)
    if temp>=A and temp<=B:
      ans+=temp
print(ans)

Submission status: Wrong Answer

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

while count <= n:
    c_tth = int(count/10000)
    c_th = int(count/1000 - c_tth*10000)
    c_hun = int(count/100 - c_tth*10000 - c_th*1000)
    c_ten = int(count/10 - c_tth*10000 - c_th*1000 - c_hun*100)
    c_o = int(count - c_tth*10000 - c_th*1000 - c_hun*100 - c_ten*10)

    c_check = c_tth + c_th + c_hun + c_ten + c_o

    if a <= c_check and b >= c_check:
        sum += count

    count += 1


print("{}".format(sum))

Submission status: Wrong Answer

Solution code:
N, A, B = input().split()
N = int(N)
A = int(A)
B = int(B)
Z = list()
X = int(0)
for i in range (N):
    X = X + 1
    M =X // 1000
    N = (X - M * 1000)// 100
    O = (X - M * 1000 - N * 100)//10
    P = (X - M * 1000 - N * 100 - O * 10 )
    S = M + N + O + P
    if A <= S <= B:
        Z.append(X)
print(sum(Z))

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

result = 0

for i in range(n):
    x = 0
    #print(i)
    for j in range(len(str(i+1))):
        x += ((i+1)/(10**j)) % 10
    if a <= int(x) and int(x) <= b:
        #print(i+1)
        result += i+1
print(result)

Submission status: Wrong Answer

Solution code:
n, a, b = map(int, input().split())
cnt = 0 #nの桁数-1
ans = 0
print(n)
for i in range(n+1):
	# n までの数字でループ
	sum_ = 0
	m = i

	while True:
		sum_ += m % 10
		m //= 10
		if not m:
			break
	if a <= sum_ <= b:
		ans += i

print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N,a,b = map(int, input().split())
sum=0
for v in range(2):
  for i in range(10):
    for j in range(10):
        for k in range(10):
            c=1000*v+100*i+10*j+k
            if c<=N and a<=i+j+k and i+j+k<=b:
                sum=sum+c
print(sum)

Submission status: Wrong Answer

Solution code:
N,a,b = map(int, input().split())
sum=0
for i in range(10):
    for j in range(10):
        for k in range(10):
            c=100*i+10*j+k
            if c<=N and a<=i+j+k and i+j+k<=b:
                sum=sum+c
print(sum)

Submission status: Wrong Answer

Solution code:
N,a,b = map(int, input().split())
sum=0
for i in range(10):
    for j in range(10):
        for k in range(10):
            c=100*i+10*j+k
            if c<=N and a<=i+j+k and i+j+k<=b:
                sum=sum+c
print(sum)

Submission status: Wrong Answer

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

for i in range(A,N+1):
  if i == 1000:
    total.append(1)
    
  if i<10 and i<=B:
    total.append(i)
  elif i>=10 and i<100:
    i = str(i)
    if int(i[0])+int(i[1])<=B and int(i[0])+int(i[1])>=A:
      total.append(int(i))
  elif i>=100 and i<=1000:
    i = str(i)
    if int(i[0])+int(i[1])+int(i[2])<=B and int(i[0])+int(i[1])+int(i[2])>=A:
      total.append(int(i))
print(sum(total))

Submission status: Wrong Answer

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

for i in range(1,N+1):
  if i == 1000:
    total.append(1)
    
  if i<10 and i<=B and i>=A:
    total.append(i)
  elif i>=10 and i<100:
    i = str(i)
    if int(i[0])+int(i[1])<=B and int(i[0])+int(i[1])>=A:
      total.append(int(i))
  elif i>=100 and i<=1000:
    i = str(i)
    if int(i[0])+int(i[1])+int(i[2])<=B and int(i[0])+int(i[1])+int(i[2])>=A:
      total.append(int(i))
   
print(sum(total))

Submission status: Wrong Answer

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

for i in range(A,N+1):
  if i == 1000:
    total.append(1)
    
  if i<10 and i<=B:
    total.append(i)
  elif i>=10 and i<100:
    i = str(i)
    if int(i[0])+int(i[1])<=B and int(i[0])+int(i[1])>=A:
      total.append(int(i))
  elif i>=100 and i<=1000:
    i = str(i)
    if int(i[0])+int(i[1])+int(i[2])<=B and int(i[0])+int(i[1])+int(i[2])>=A:
      total.append(int(i))
   
print(sum(total))

Submission status: Wrong Answer

Solution code:
N,A,B = map(int,input().split())
total = []
ans = []
for i in range(A,N+1):
  if i == 1000:
    total.append(1)
  elif i<10 and i<=B:
    total.append(i)
  elif i>=10 and i<100:
    i = str(i)
    if int(i[0])+int(i[1])<=B and int(i[0])+int(i[1])>=A:
      total.append(int(i))
  elif i>=100 and i<1000:
    i = str(i)
    if int(i[0])+int(i[1])+int(i[2])<=B and int(i[0])+int(i[1])+int(i[2])>=A:
      total.append(int(i))
   
print(sum(total))

Submission status: Wrong Answer

Solution code:
N,A,B = map(int,input().split())
total = []
ans = []
for i in range(A,N+1):
  if i == 1000:
    total.append(1)
  elif i<10 and i<=B:
    total.append(i)
  elif i>=10 and i<100:
    i = str(i)
    if int(i[0])+int(i[1])<=B and int(i[0])+int(i[1])>=A:
      total.append(int(i))
  elif i>=100 and i<1000:
    i = str(i)
    if int(i[0])+int(i[1])+int(i[2])<=B and int(i[0])+int(i[1])+int(i[2])>=A:
      total.append(int(i))
print(sum(total))

Submission status: Wrong Answer

Solution code:
N,a,b = (int(x) for x in input().split())
z = 0
for I in range (N):
    o = 0
    i = I+1
    while True:
        o += i%10
        i = round (i/10)
        if i == 0:
            if a <= o <= b:
                z += I+1
            break
print (z)

Submission status: Wrong Answer

Solution code:
N,a,b = (int(x) for x in input().split())
z = 0
for I in range (N+1):
    o = 0
    i = I
    while True:
        o += i%10
        i = round (i/10)
        if i == 0:
            if a <= o <= b:
                print (I)
                z += I
            break
print (z)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N,A,B=map(int,input().split())
 
Alltotal=0
for i in range(1,N+1):
  partTotal=0
  while i!=0:
    partTotal+=i%10
    i=i//10
    
  if A<=partTotal and partTotal<=B:
    Alltotal+=partTotal

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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: Wrong Answer

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

ans = 0
for i in range(1, n + 1):
  t = 0
  k = i
  while(True):
    t += k % 10
    k = k / 10
    if k == 0:
      break
  if a <= t <= b:
    ans += 1
print(ans)

Submission status: Wrong Answer

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

for i in range(1,n + 1):
    length = len(str(i)) # iの桁数
    ele = []
    for j in range(1, length + 1):
        num = str(i)[-j]
        num = int(num)
        ele.append(num)
    s = sum(ele)
    if a <= s and s <= b:
        total += s
print(total)

Submission status: Wrong Answer

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

if 1<=A<=36 and 1<=B<=36 and A<=B:
    
    num_list=[]
    for x in range(10):
        for y in range(10):
            num=10*x+y
            if 1<=num<=N and A<=(x+y)<=B:
                num_list.append(num)
    
    print(sum(num_list))
    
else:
    print(0)

Submission status: Wrong Answer

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

num_list=[]
for x in range(10):
    for y in range(10):
        num=10*x+y
        if 1<=num<=N and A<=(x+y)<=B:
            num_list.append(num)

print(sum(num_list))

Submission status: Wrong Answer

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

ans_list = []
for i in range(1, n+1):
  if i <= 9:
    if a <= i <= b:
      ans_list.append(i)
  elif 10 <= i <= 99:
    i10 = i // 10
    i1 = i % 10
    if a <= i10+i1 <= b:
      ans_list.append(i)
  elif 100 <= i <= 999:
    i100 = i // 100
    i10 = (i % 100) // 10
    i1 = (i % 100) % 10
    if a <= i100+i10+i1 <= b:
      ans_list.append(i)
  elif 1000 <= i <= 9999:
    i1000 = i // 1000
    i100 = (i % 1000) // 100
    i10 = ((i % 1000) % 1000) // 10
    i1 = ((i % 1000) % 1000) % 10
    if a <= i1000 +i100 +i10 +i1 <= b:
      ans_list.append(i)
  else:
    if a <= 1 <= b:
      ans_list.append(i) 

print(sum(ans_list))

Submission status: Wrong Answer

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

ans_list = []
for i in range(1, n+1):
  if i <= 9:
    if a <= i <= b:
      ans_list.append(i)
  elif 10 <= i <= 99:
    i10 = i // 10
    i1 = i % 10
    if a <= i10+i1 <= b:
      ans_list.append(i)
  elif 100 <= i <= 999:
    i100 = i // 100
    i10 = (i % 100) // 10
    i1 = (i % 100) % 10
    if a <= i100+i10+i1 <= b:
      ans_list.append(i)
  elif 1000 <= i <= 9999:
    i1000 = i // 1000
    i100 = (i % 1000) // 100
    i10 = ((i % 1000) % 1000) // 10
    i1 = ((i % 1000) % 1000) % 10
    if a <= i1000 +i100 +i10 +i1 <= b:
      ans_list.append(i)
  else:
    if a <= 1 <= b:
      ans_list.append(i)

Submission status: Wrong Answer

Solution code:
n,a,b=map(int,input().split())
gou=0
for i in range(1,n+1):
    on=0
    k=i
    while True:
        on += k%10
        k= k//10
        if k==0:
          break
    if on >= 2 and on <= 5:
        gou = gou+i
print(gou)

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python3
#
# Author: Tetsuya Ishikawa <tiskw111@gmail.com>
# Date  : June 30, 2020
##################################################### SOURCE START #####################################################

import itertools
import math

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

Ns = list(range(10))
L  = int(math.log10(N)) + 1
s  = 0

for n in range(N + 1):
    n1 = n % 10
    n2 = (n // 10) % 10
    n3 = (n // 100) % 10
    n4 = (n // 1000) % 10
    p = n1 + n2 + n3 + n4
    if A <= p <= B:
        s += n

print(s)

##################################################### SOURCE FINISH ####################################################
# vim: expandtab tabstop=4 shiftwidth=4 fdm=marker

Submission status: Wrong Answer

Solution code:
N, A, B = map(int, input().split())
souwa = 0
for i in range(1, N+1):
    sumketa = (i//1000) + ((i%1000)//100) + ((i%100)//10) + (i%10)
    if A <= sumketa <= B:
        souwa += i
print(souwa)

Submission status: Wrong Answer

Solution code:
def sum_of_digits(n):
  s = 0
  while n > 0:
    s += n % 10
    n = int(n / 10)
  return s

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

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

Submission status: Wrong Answer

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

def check_num(n):
  s  = str(n)
  array = list(map(int,s))
  return sum(array)


list_1 = [i for i in range(1,N+1)]

list_2 = []

for _ in list_1:
  if A<=check_num(_)<=B:
    list_2.append(_)
  else:
    pass

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

print(ans)

Submission status: Wrong Answer

Solution code:
a,b,c=map(int,input().split())
ans=0
for i in range(1,a+1):
    n=i//10**4+i//10**3+1//10**2+i//10**1+i%10**1
    if b<=n<=c:
        ans+=i

print(ans)

Submission status: Wrong Answer

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

ans = 0

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

print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

def f(x):
    sum = 0
    while x > 0:
        sum += x % 10
        x //= 10
    return sum

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

print(count)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

for i in range(N + 1):
  q, mod = divmod(i, 10)
  if A <= q + mod and q + mod <= B:
    ans += 10 * q + mod

print(ans)

Submission status: Wrong Answer

Solution code:
"""
B - Some Sums
"""
ans = 0
#入力される数n, a, b
N, a, b = map(int, input().split())

def digitSum(n):
    d = str(n)   #iの数値を文字列に変換 d ←　下記eにおいてitrrableなものが求められるため文字列に変換する
    #print(d)
    e = list(map(int, d))   #1文字ずつ数値化し配列にする
    #print(e)
    f = sum(e)
    return f

#print(a, b, n)
for i in range(N+1):
    digitSum(i)
    if a <= digitSum(i):
        if b >= digitSum(i):
            print(digitSum(i))
            ans += i

print(ans)