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:
def main():
    num = list(map(int, input().split()))
    total_sum = 0
    print(num[0])
    for i in range(1,num[0]+1):
        current = i
        current_sum=0
        while i >= 1:
            current_sum += i %10
            i = int(i/10)
        if ((current_sum >= num[1]) and (current_sum <= num[2])):
            total_sum += current
    print(total_sum)
main()

Submission status: Wrong Answer

Solution code:
def main():
    num = list(map(int, input().split()))
    total_sum = 0
    print(num[0])
    for i in range(1,num[0]+1):
        current = i
        current_sum=0
        while i >= 1:
            current_sum += i %10
            #ここ i = i/10だと動かなかった
            i = int(i/10)
        if ((current_sum >= num[1]) and (current_sum <= num[2])):
            total_sum += current
    print(total_sum)
main()

Submission status: Wrong Answer

Solution code:
def main():
    num = list(map(int, input().split()))
    total_sum = 0
    print(num[0])
    for i in range(1,num[0]+1):
        current = i
        current_sum=0
        while i >= 1:
            current_sum += i %10
            i /=10
        if ((current_sum >= num[1]) and (current_sum <= num[2])):
            total_sum += current
    print(total_sum)
main()

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

def tasu(i):
  k=0
  s=0
  while 10**k<i:
    k+=1
  for a in range(k)[::-1]:
    s+=i//(10**a)
    i-=10**a*(i//(10**a))
  return(s)
    

for i in range(N):
  if A<=tasu(i+1)<=B:
    answer+=i+1
print(answer)

Submission status: Wrong Answer

Solution code:
n, a, b = map(int, input().split())
sum = 0
for i in range(a, b + 1):
    for j in range(i+1):
        if 10 * i - 9 * j <= n:
            sum +=  10 * i - 9 * j
print(sum)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

cnt = 0

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

print(cnt)

Submission status: Wrong Answer

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

cnt = 0

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

print(cnt)

Submission status: Wrong Answer

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

cnt = 0

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

print(cnt)

Submission status: Wrong Answer

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

cnt = 0

for n in range(1,N+1):
  temp = 0
  temp += n%10
  temp += int(n/10)%10
  temp += int(n/10/10)%10
  temp += int(n/10/10/10)%10
  if temp >= A and temp <= B:
    cnt += n

print(cnt)

Submission status: Wrong Answer

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

cnt = 0

for n in range(1,N+1):
  temp = 0
  temp += n%10
  temp += int(n/10)%10
  temp += int(n/10/10)%10
  if temp >= A and temp <= B:
    cnt += n

print(cnt)

Submission status: Wrong Answer

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

cnt = 0

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

print(cnt)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

def count(x):
	ans = x % 10  #4 = 834% 10

	x_100 = x // 10  #83 = 834 // 10
	ans += x_100 % 10 #ans = 4 + (83 % 10)

	x_10 = x_100 // 10 # = 4
	ans += x_10 % 10
	return ans


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

print(str(ans_a))

Submission status: Wrong Answer

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

def count(x):
	count_100 = x // 100
	x_100 = x - count_100 * 100
	count_10 = x_100 // 10
	x_10 = x_100 - count_10 * 10
	count_1 = x_10 //1
	return count_100 + count_10 + count_1

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

print(str(ans))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

for i in range(1, n+1):
  q = i // 1000
  qi = i % 1000
  w = qi // 100
  wi = qi % 100
  e = wi // 10
  ei = wi % 10
  r = ei // 1
  sum = q + w + e + r
  if sum >= a and sum <= b:
    x += i
    
print(x)

Submission status: Wrong Answer

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

for i in range(1, n+1):
  q = i // 1000
  qi = i % 1000
  w = qi // 100
  wi = qi % 100
  e = wi // 10
  ei = wi % 10
  r = ei
  sum = q + w + e + r
  if sum >= a and sum <= b:
    x += i
    
print(x)

Submission status: Wrong Answer

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

for i in range(n+1):
  q = i // 1000
  qi = i % 1000
  w = qi // 100
  wi = qi % 100
  e = wi // 10
  ei = wi % 10
  r = ei
  sum = q + w + e + r
  if sum >= a and sum <= b:
    x += i
    
print(x)

Submission status: Wrong Answer

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

for i in range(n+1):
  q = i
  w = i / 10
  e = i / 100
  r = i / 1000
  sum = q + w + e + r
  if sum >= a and sum <= b:
    x += i
    
print(x)

Submission status: Wrong Answer

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

for i in range(n+1):
  q = i
  w = i / 10
  e = i / 100
  r = i / 1000
  sum = q + w + e + r
  if sum >= a and sum <= b:
    x += sum
    
print(x)

Submission status: Wrong Answer

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

for i in range(n):
  q = i
  w = i / 10
  e = i / 100
  r = i / 1000
  sum = q + w + e + r
  if sum >= a and sum <= b:
    x += 1
    
print(x)

Submission status: Wrong Answer

Solution code:
from functools import reduce 
from operator import add
n, a, b = map(int, input().split())

n_cond = 0

for i in range(n+1):
  i_str = str(i)

  if len(i_str) == 1:
    order_sum = i
    
  else:
    temp = list(map(int, i_str))
    order_sum = reduce(add, temp)
    
  if order_sum >= a and order_sum <= b:
    n_cond += 1
print(n_cond)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

for i in range(N+1):
    T = (i//1000) + ((i//100)%10) + ((i//10)%10) + (i%10)
    if (A<=T) and (T<=B):
        L += i

print(L)

Submission status: Wrong Answer

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

def findSum(n):
    sum_total = 0
    while n > 0:
        sum_total += n % 10
        n /= 10
    return int(sum_total)

total = 0
for i in range(1, N + 1):
    sum_total = findSum(i)
    if sum_total >= A and sum_total <= B:
        total += i

print(total)

Submission status: Wrong Answer

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

def findSum(n):
    sum_total = 0
    while n > 0:
        sum_total += n % 10
        n = n / 10
    return sum_total

total = 0
for i in range(1, N + 1):
    sum_total = findSum(i)
    if sum_total >= A and sum_total <= B:
        total += 1

print(total)

Submission status: Wrong Answer

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

def findSum(n):
    sum_total = 0
    while n > 0:
        sum_total = n % 10
        n = n / 10
    return sum_total

total = 0
for i in range(1, N + 1):
    sum_total = findSum(i)
    if sum_total >= A and sum_total <= B:
        total += 1

print(total)

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
def sum_digits(n):
  sum = 0
  while(n > 0):
    sum += int(n % 10)
    n = n //10
  return sum
   
 
  
def main():
  n, a, b = map(int, input().strip().split())
  total = 0
  for i in range(n+1):
    tmp = sum_digits(n)
    if (tmp >= a) & (tmp <= b):
      total += tmp
  print(total)
 
    
if __name__=="__main__":
  main()

Submission status: Wrong Answer

Solution code:
def sum_digits(n):
  sum = 0
  while(n > 0):
    sum += int(n % 10)
    n = n //10
  return sum
   
 
  
def main():
  n, a, b = map(int, input().strip().split())
  total = 0
  for i in range(n+1):
    tmp = sum_digits(n)
    if (tmp >= a) & (tmp <= b):
      total += tmp
  print(total)
 
    
if __name__=="__main__":
  main()

Submission status: Wrong Answer

Solution code:
lst = list(map(int, input().split()))
ans = 0
tot = 0
cnt = 0

for i in range(1,lst[0]+1):
    flg = True
    val = i
    while flg:
        cnt += 1
        tot = tot + val%10
        val = val//10

        if val==0:
            if ( lst[1] <= tot and
                 tot <= lst[2] ):
                ans = ans + i

            tot = 0
            flg = False


print("Sum: " + str(ans))

Submission status: Wrong Answer

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

#print(n)
#print(a)
#print(b)

t = 0
ans = 0

for ii in range(n) :
  i = ii+1
  t100 = i // 100
  t10  = (i%100) // 10
  t1   = i%10
  sum = t100 + t10 + t1

  #print("i : " + str(i))
  #print("t100 : " + str(t100))
  #print("t10 : " + str(t10))
  #print("t1 : " + str(t1))
  #print("sum : " + str(sum))

  if a <= sum and sum <= b :
    ans = ans + i
    #print("ans : " + str(ans))

print(ans)

Submission status: Wrong Answer

Solution code:
n, a, b = map(int, input().split())
total = 0
for i in range(0, n+1):
  m = 0
  ni = i
  for j in range(1, 5):
    m += (ni % 10**j) / 10**(j-1)
    ni = ni - (ni % 10**j)
  if a <= m <= b:
    total += i
print(total)

Submission status: Wrong Answer

Solution code:
n, a, b = map(int, input().split())
total = 0
for i in range(1, n+1):
  m = 0
  ni = i
  for j in range(1, 5):
    m += (ni % 10**j) / 10**(j-1)
    ni = ni - (ni % 10**j)
  if a <= m <= b:
    total += i
print(total)

Submission status: Wrong Answer

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

print(ans)

Submission status: Wrong Answer

Solution code:
N, A, B = map(int, input().split())
def keta_sum(x):
    m = 0
    while x%10 !=0:
        m += x%10
        x = x//10
    return(m)
res = 0
for i in range(N+1):
    if A <= keta_sum(i) <= B:
        res += i
print(res)

Submission status: Wrong Answer

Solution code:
N, A, B = map(int, input().split())
def keta_sum(x):
    sum = 0
    while x%10 !=0:
        sum += x%10
        x = x//10
    return(sum)
res = 0
for i in range(N+1):
    if A <= keta_sum(i) <= B:
        res += i
print(res)

Submission status: Wrong Answer

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

def keta_sum(x):
    sum = 0
    while x%10 !=0:
        sum += x%10
        x = x//10
    return(sum)

#cnt=0
total=0
for x in range(N+1):
    y = keta_sum(x)
    if A<=y<=B:
        #cnt +=1
        total +=x 
            
print(total)

Submission status: Wrong Answer

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

def keta_sum(x):
    sum = 0
    while x%10 !=0:
        sum += x%10
        x = x//10
    return(sum)

#cnt=0
total=0
for x in range(1,N+1):
    y = keta_sum(x)
    if A<=y<=B:
        #cnt +=1
        total +=x 
            
print(total)

Submission status: Wrong Answer

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

count = 0
for i in range(1,N+1):
    tot = 0
    num = i
    for j in range(4):
        tot = tot + num%10
        num = int(num/10)
    if tot >= A and tot <= B:
        count += i

print(count)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

ans = 0
for x in range(1,n+1):
    print('x=='+str(x))
    sum = 0
    y = x
    while x > 0:
        sum += x%10
        x = int(x/10)
    if a<= sum <= b: 
        print(a)
        ans += y
print(ans)

Submission status: Wrong Answer

Solution code:
import sys
input = sys.stdin.readline
N, A, B = [int(x) for x in input().split()]
ans = 0
for i in range(1, N + 1):
    i = str(i)
    total = 0
    for j in i:
        total += int(j)
    if A <= total <= B:
        ans += 1
print(ans)

Submission status: Wrong Answer

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

res = 0
for i in range(1, n + 1):
    if i <= 9:
        plus = i
    elif i <= 99:
        p = i // 10
        q = i % 10
        plus = p + q
    elif i <= 999:
        p = i // 100
        x = i % 100
        q = x // 10
        r = x % 10
        plus = p + q + r
    else:
        plus = 1
    if a <= plus <= b:
        res += i
        
print(res)

Submission status: Wrong Answer

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

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

Submission status: Wrong Answer

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

for i in range(N):
    num = i+1
    sum = 0
    for j in range(4):
        sum += num%10
        num = num//10
    if A <= sum <= B:
        ans += i+1

print(ans)

Submission status: Wrong Answer

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

def rel(n):
  k10000=n//10000
  k1000=(n%10000)//1000
  k100=(n%1000)//100
  k10=(n%100)//10
  k1=n%10//1
  return k1000+k100+k10+k1

result=[]
for x in range(1,n+1):
  if b >= rel(x) >= a:
    result.append(x)

print(sum(result))

Submission status: Wrong Answer

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

def rel(n):
  k1000=n//1000
  k100=n//100
  k10=(n-n//100*100)//10
  k1=n%10
  return k1000+k100+k10+k1

result=[]
for x in range(1,n+1):
  if b >= rel(x) >= a:
    result.append(x)

print(sum(result))

Submission status: Wrong Answer

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

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

print(cnt)

Submission status: Wrong Answer

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

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

print(cnt)

Submission status: Wrong Answer

Solution code:
li=list(map(int,input().split()))
sum=0
for i in range(1,li[0]+1):
    a=i//1000%10
    b=i//100%10
    c=i//10%10
    d=i%10
    s=a+b+c+d
    if li[1]<=s<=li[2]:
        sum+=i
print(sum)

Submission status: Wrong Answer

Solution code:
li=list(map(int,input().split()))
sum=0
for i in range(1,li[0]+1):
    a=i//1000
    b=i//100%10
    c=i//10%10
    d=i%10
    s=a+b+c+d
    if li[1]<=s<=li[2]:
        sum+=i
print(sum)

Submission status: Wrong Answer

Solution code:
li=list(map(int,input().split()))
sum=0
for i in range(1,li[0]+1):
    a=i//1000
    b=i//100%10
    c=i//10%10
    d=i%10
    s=a+b+c+d
    if li[1]<=s<=li[2]:
        #print(i)
        sum+=i
print(sum)

Submission status: Wrong Answer

Solution code:
li=list(map(int,input().split()))
sum=0
for i in range(1,li[0]+1):
    a=i//1000
    b=i//100%10
    c=i//10%10
    d=i%10
    if li[1]<=a+b+c+d<=li[2]:
        sum+=a+b+c+d
print(sum)

Submission status: Wrong Answer

Solution code:
#abc083 b-some sums
n,a,b=map(int,input().split())
num=[str(x) for x in range(1,n+1)]
ans=0
for x in num:
    s=0
    for y in range(len(x)):
        s+=int(x[y])
    if s>=a and s<=b:
        ans+=s
print(ans)

Submission status: Wrong Answer

Solution code:
import math

li = list(map(int,input().split()))
a = li[0]
b = li[1]
c = li[2]

list = []

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

  while(i >= 1):
    ans += i % 10
    i = math.floor(i / 10)

  if b <= ans <= c:
    list.append(tmp)

print(list)
data = 0
for e in list:
  data += e

print(data)

Submission status: Wrong Answer

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

b = []
for i in range(N+1):
    a = [int(j) for j in list(str(i))]
    if A <= sum(a) <=B:
        b.append(i)

print(b)
print(sum(b))

Submission status: Wrong Answer

Solution code:
x,y,z = map(int,input().split())
count = 0
for i in range(1,x+1) :
    LIST = [int(x) for x in list(str(i))]
    if y <=sum(LIST) <=z :
        count +=1       
print(count)

Submission status: Wrong Answer

Solution code:
x,y,z = map(int,input().split())
count = 0
for i in range(1,x) :
    LIST = [int(x) for x in list(str(i))]
    if y <=sum(LIST) <=z :
        count +=1       
print(count)

Submission status: Wrong Answer

Solution code:
x,y,z = map(int,input().split())
count = 0
for i in range(1,x) :
    LIST = [int(x) for x in list(str(i))]
    if y <sum(LIST) <z :
        count +=1       
print(count)

Submission status: Wrong Answer

Solution code:
a = list(map(int,input().split()))
N,A,B = a[0],a[1],a[2]
k = 1
x = True
while x:
    if 10**(k-1) <= N and N < 10**k:
        x = False
    else:
        k += 1
u = 1
M = 0
while u <= k:
    if u == 1:
        v = 1
        while v <= 9:
            if v>= A and v <= B and v <= N:
               M += v
            v += 1
    elif u == 2:
        v,w = 1,0
        while v <= 9:
            while w <= 9:
                 if v+w <=B and v+w >= A and 10*v+w<=N:
                     M += 10*v +w
                 w += 1
            w=0
            v += 1
    else:
        v,w,x =1,0,0
        while v<=9:
            while w <= 9:
                while x <= 9:
                    if v+w+x >= A and v+w+x <= B and 100*v+10*w+x<=N:
                        M += 100*v + 10*w + x
                    x += 1
                x=0
                w += 1
            w=0
            v += 1
    u += 1
print(M)

Submission status: Wrong Answer

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

for i in range(n+1):
  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())
count = 0
total = 0
for i in range(1,n+1,1):
    str_i = str(i)
    for j in range(len(str_i)):
        total+=int(str_i[j])
    if total >= a and total <= b:
        print(i)
        count+=i
    total=0
print(count)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
a = list(map(int,input().split()))
N,A,B = a[0],a[1],a[2]
k = 1
x = True
while x:
    if 10**(k-1) <= N and N < 10**k:
        x = False
    else:
        k += 1
u = 1
M = 0
while u <= k:
    if u == 1:
        v = 1
        while v <= 9:
            if v>= A and v <= B and v <= N:
               M += v
            v += 1
    elif u == 2:
        v,w = 1,0
        while v <= 9:
            while w <= 9:
                if v+w <=B and v+w >= A and 10*v+w<=N:
                     M += 10*v +w
                w += 1
            w=0
            v += 1
    else:
        v,w,x =1,0,0
        while v<=9:
            while w <= 9:
                while x <= 9:
                    if v+w+x >= A and v+w+x <= B and 100*v+10*w+x<=N:
                        M += 100*v + 10*w + x
                    x += 1
                x=0
                w += 1
            w=0
            v += 1
    u += 1
print(M)

Submission status: Wrong Answer

Solution code:
a = list(map(int,input().split()))
N,A,B = a[0],a[1],a[2]
k = 1
x = True
while x:
    if 10**(k-1) <= N and N < 10**k:
        x = False
    else:
        k += 1
u = 1
M = 0
while u <= k:
    if u == 1:
        v = 1
        while v <= 9:
            if v>= A and v <= B and v <= N:
               M += v
            v += 1
    elif u == 2:
        v,w = 1,0
        while v <= 9:
            while w <= 9:
                 if v+w <=B and v+w >= A and 10*v+w<=N:
                     M += 10*v +w
                 w += 1
            w=0
            v += 1
    else:
        v,w,x =1,0,0
        while v<=9:
            while w <= 9:
                while x <= 9:
                    if v+w+x >= A and v+w+x <= B and 100*v+10*w+x<=N:
                        M += 100*v + 10*w + x
                    x += 1
                x=0
                w += 1
            w=0
            v += 1
    u += 1
print(M)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N,A,B = map(int,input().split())
count = 0
for i in range(1,N+1):
    if i <=9:
        if i >= A and i <= B:
            count += i
    elif i <= 99:
        k = str(i)
        m = int(k[0]) + int(k[1])
        if m >= A and m <= B:
            count += i
    elif i <=999:
        k = str(i)
        m = int(k[0]) + int(k[1]) + int(k[2])
        if m >= A and m <= B:
            count += i
    else:
        m = 1
        if m >= A and m <= B:
            count += i
print(count)

Submission status: Wrong Answer

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

for i in range(N + 1):
    if i < 10:
        if i >= A and i <= B:
            ans += i
    elif i < 100:
        if int(i/10) + i%10 >= A and int(i/10) + i%10 <= B:
            ans += i
    elif i < 1000:
        if int(i/100) + int(i%100/10) + i%10 >= A and int(i/100) + int(i%100/10) + i%10 <= B:
            ans += i
    elif i == 1000:
        if 1 >= A and 1 <= B:
            ans+=1

print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

def func_10(x):
    ans = 0
    
    while x/10 != 0:
        ans += x % 10
        x  = x//10
                
    return ans

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

print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
# coding: utf-8
# Your code here!
#-*- coding: utf-8 -*-#
test = "100 4 16"
a, b, c = map(int, test.split())  # 変数a,b,cにそれぞれN、A、Bをint型にして入力する　
x = []
e = []
for i in range(1,a+1):  # list型の変数xに１からNまでの要素を入れる
    x.append(i)
len_x = len(x)  # リスト型の変数xの要素数を獲得
d = 0  # リストの各行の和を入れるための変数
f = []  # 各行がA以上B以下の要素を入れるための変数
x = map(str, x) # リストxの各要素をstr型に変換
x = list(x)
e_number = 0
for i in range(len_x):
    e = x[i]           # xのi番目の要素を抽出
    e = list(e)  # xのi番目の要素を一文字ずつのstr型としてリスト型の変数に入れる
    e = map(int, e)# xのi番目の要素をint型に変換
    e = list(e)
    e_number = len(e)   # リスト型の変数eの要素数を取得
    d = 0              # 位の合計の判定用の変数
    for g in range(e_number):
        d += e[g-1]  # 位の合計
    if b <= d <= c:  # 位の合計がA以上B以下ならリストfに要素を追加
        f.append(x[i])
answer = 0  # 条件位合う要素の合計を入れる変数
f = map(int, f)
for h in f:
    answer += h  # 要素に合う要素の合計
print(answer)

Submission status: Wrong Answer

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

ylist = []
for i in range(N+1):
  xlist = []
  x = i%10
  xlist.append(x)
  count = 1
  while i/(10**count) >= 1:
    x = int(i/10)
    x = x%10
    xlist.append(x)
    x = int(i/10)
    count += 1
  if sum(xlist) >= A and sum(xlist)<= B:
    ylist.append(i)

print(sum(ylist))

Submission status: Wrong Answer

Solution code:
n,a,b = input().split()
S = 0
C = 0

for j in range(1,int(n)+1): #1<=j<=nを出力
  j = str(j)
  for i in range(len(j)): #整数の各位の和を求める
    S += int(j[i])
  if int(a) <= S <= int(b):
    C += int(j)
  else:
    C += 0

print(C)

Submission status: Wrong Answer

Solution code:
#coding:utf-8

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

cnt = 0
for i in range(1, n + 1):
  str_i = str(i)
  sum = 0
  for char in str_i:
    sum += int(char)
  if sum >= a and sum <= b:
    cnt += 1
    
print(cnt)

Submission status: Wrong Answer

Solution code:
#coding:utf-8

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

cnt = 0
for i in range(n):
  str_i = str(i)
  sum = 0
  for char in str_i:
    sum += int(char)
  if sum >= a and sum <= b:
    cnt += 1
    
print(cnt)

Submission status: Wrong Answer

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

rslt = 0
for i in range(1,n+1):
    s = str(i)
    sum = 0
    for j in s:
        # sum += int(j)
        sum = sum + int(j)
    if sum >= a and sum <= b:
        rslt += sum

print(rslt)

Submission status: Wrong Answer

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

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

print(rslt)

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python

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

ans = 0;
for num in range(1, N+1):
    l = []
    q, r = divmod(num, 10)
    l.append(r)
    l.append(q % 10)
    if A <= sum(l) and sum(l) <= B:
        # print(num)
        ans += num

print(ans)

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python

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

ans = 0;
for num in range(1, N+1):
    l = []
    q, r = divmod(num, 10)
    l.append(r)
    l.append(q % 10)
    if A <= sum(l) and sum(l) <= B:
        print(num)
        ans += num

print(ans)

Submission status: Wrong Answer

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

def digitSum(n):
    # 数値を文字列に変換
    s = str(n)
    # １文字ずつ数値化し配列にする。
    array = list(map(int, s))
    # 合計値を返す
    return sum(array)

# print(digitSum(123))
# => 6
# print(digitSum(35829))
# => 27

for i in l:
    if digitSum(i) >= a and digitSum(i) <= b:
        ans += digitSum(i)
print(ans)

Submission status: Wrong Answer

Solution code:
def s(num):
  val=0
  while num>0:
    val+=num%10
    num=num//10
  return val
n,a,b=[int(s) for s in input().split()]
ans=0
for i in range(1,n+1):
  x=s(i)
  if a<=s(i) and s(i)<=b:
    ans+=1
print(ans)

Submission status: Wrong Answer

Solution code:
dbflag=""

def debug(*args):
	if ""!=dbflag: print(*args)

if ""!=dbflag: _INDATA=open(dbflag)

def readline():
	if ""!=dbflag:return _INDATA.readline()
	else: return input()


result = 0

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




for i4 in range(0,2):
	for i3 in range(0,10):
		for i2 in range(0,10):
			for i1 in range(0,10):
				s = i4 + i3 + i2 + i1
				sss = 1000 *i4 + 100 * i3 + 10 * i2 + i1
				if sss > N :
				  break
          
				if A<= s and s <= B:
					result += sss

print(result)

Submission status: Wrong Answer

Solution code:

dbflag=""
def debug(*args):
	if ""!=dbflag: print(*args)

if ""!=dbflag: _INDATA=open(dbflag)

def readline():
	if ""!=dbflag:return _INDATA.readline()
	else: return input()


result = 0

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




for i4 in range(0,2):
	for i3 in range(0,10):
		for i2 in range(0,10):
			for i1 in range(0,10):
				s = i4 + i3 + i2 + i1
				sss = 1000 *i4 + 100 * i3 + 10 * i2 + i1
				if sss > N :
				  break
          
				if A<= s and s <= B:
					result += sss

print(result)

Submission status: Wrong Answer

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

ans = 0
for n in range(N+1):
    sum = int(n%10) + int((n//10)%10) + int((n//100)%10) + int((n//1000)%10)
    if A <= sum <= B:
        ans += n

print(ans)

Submission status: Wrong Answer

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

ans = 0
for n in range(N+1):
    sum = int(n%10) + int(n//10%10) + int(n//100%10) + int(n//1000%10)
    if A <= sum <= B:
        ans += n
        print(sum)

print(ans)

Submission status: Wrong Answer

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

ans = 0
for n in range(N+1):
    sum = int(n%10) + int((n//10)%10) + int((n//100)%10)
    if A <= sum <= B:
        ans += n
        print(sum)

print(ans)

Submission status: Wrong Answer

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

ans = 0
for n in range(N+1):
    sum = int(n%10) + int((n//10)%10) + int((n//100)%10)
    if sum <= B and sum >= A:
        ans += n
        # print(sum)

print(ans)

Submission status: Wrong Answer

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

ans = 0
for n in range(N+1):
    sum = int(n%10) + int(n//10%10) + int(n//100%10)
    if sum <= B and sum >= A:
        ans += n
        # print(sum)

print(ans)

Submission status: Wrong Answer

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

ans = 0
for n in range(N+1):
    sum = int(n%10) + int(n/10%10) + int(n/100%10)
    if sum <= B and sum >= A:
        ans += n
        # print(sum)

print(ans)

Submission status: Wrong Answer

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

ans = 0
for n in range(1,N+1):
    sum = int(n%10) + int(n/10%10) + int(n/100%10)
    if sum <= B and sum >= A:
        ans += n
        # print(sum)

print(ans)

Submission status: Wrong Answer

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