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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N, A, B = list(map(int, input().split()))
sum = 0
for i in range(1, N + 1):
    t1 = i % 10
    t10 = (i // 10) % 10
    t100 = (i // 10**2) % 10
    if A <= t1 + t10 + t100 <= B:
        sum += i
print(sum)

Submission status: Wrong Answer

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

    cnt = 0
    for i in range(1, n + 1):    
        if a <=sum([int(num) for num in str(i)]) <= b:
            cnt += 1
    print(cnt)

if __name__ == '__main__':
    abc083b()

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

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

total = 0
for i in range(N):
    sum = findSUM(i)
    if (sum >= A and sum <= B):
        total += i

print(total)

Submission status: Wrong Answer

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

for i in range(N):
  temp = 0
  a = i
  
  while (a >= 10):
  
  	temp += i % 10
  	a = i // 10
  temp += a
  
  if (temp >= A and temp <= B):
    res += i
    
print(res)

Submission status: Wrong Answer

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

num_sum = 0
for i in range(N):
    res = 0
    num = i
    while num > 0:
        q, mod = divmod(num, 10)
        res += mod
        num = q
    if (res >= A) and (res <= B):
        num_sum += i

print(num_sum)

Submission status: Wrong Answer

Solution code:
li = list(map(int,input().split()))
N = li[0]
A = li[1]
B = li[2]
count = 0
for i in range(1,N + 1):
  iti = N % 10
  zyuu = (N - iti) / 10 % 10
  hyaku = ((N - iti) / 10 - zyuu) / 10 % 10
  sen = (((N - iti) / 10 - zyuu) / 10  - hyaku) / 10 % 10
  man = ((((N - iti) / 10 - zyuu) / 10 - hyaku) / 10 - sen) / 10 % 10
  total = iti + zyuu + hyaku + sen + man
  if A <= total and B >= total:
    count += 1
print(count)

Submission status: Wrong Answer

Solution code:
nab = input()

nab = nab.split()

n = int(nab[0])
a = int(nab[1])
b = int(nab[2])

ans = 0
s = 0

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

	
	
print(ans)

Submission status: Wrong Answer

Solution code:
nab = input()

nab = nab.split()

n = int(nab[0])
a = int(nab[1])
b = int(nab[2])

ans = 0

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

Submission status: Wrong Answer

Solution code:
nab = input()

nab = nab.split()

n = int(nab[0])
a = int(nab[1])
b = int(nab[2])

ans = 0

for i in range(1, n+1):
	q =  int(i / 10000)
	i = i - q*10000
	r = int( i / 1000 )
	i = i - r*1000
	s = int( i / 100 )
	i = i - s*100
	t =  int( i / 10 )
	u = i - t*10
	sum = q + r + s + t + u
	if sum >= a and sum <= b:
		ans = ans + i
		
print(ans)

Submission status: Wrong Answer

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


def main():
    n, a, b = map(int, open(0).read().split())
    res = 0
    for i in range(1, n+1):
        total = sum_digits(i)
        if a <= total and total <= b:
            res += total
    print(res)


if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
nab = input()

nab = nab.split()

n = int(nab[0])
a = int(nab[1])
b = int(nab[2])

ans = 0

for i in range(1, n+1):
	q =  int(i / 10000)
	r = int( (i - q*10000)/1000 )
	s = int( (i - r*1000)/100 )
	t =  int( (i - s*100)/10 )
	u = int( (i - t*10) )
	sum = q + r + s + t + u
	if sum >= a and sum <= b:
		ans = ans + i
		
print(ans)

Submission status: Wrong Answer

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

counter = 0

for i in range(1,n+1):
  thou = i // 1000
  hund = (i - thou * 1000) // 100
  ten  = (i - thou * 1000 - hund * 100) // 10
  one  =  i - thou * 1000 - hund * 100 - ten * 10
  sum_all = thou + hund + ten + one
  if sum_all >= a and sum_all <= b:
    counter += i

print(counter)

Submission status: Wrong Answer

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

counter = 0

for i in range(1,n+1):
  thou = i // 1000
  hund = (i - thou * 1000) // 100
  ten  = (i - thou * 1000 - hund * 100) // 10
  one  =  i - thou * 1000 - hund * 100 - ten * 10
  sum_all = thou + hund + ten + one
  if sum_all >= a and sum_all <= b:
    counter += sum_all

print(counter)

Submission status: Wrong Answer

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

counter = 0

for i in range(1,n+1):
  thou = i // 1000
  hund = (i - thou * 1000) // 100
  ten  = (i - thou * 1000 - hund * 100) // 10
  one  =  i - thou * 1000 - hund * 100 - ten * 10
  sum_all = thou + hund + ten + one
  if sum_all >= a and sum_all <= b:
    counter += 1

print(counter)

Submission status: Wrong Answer

Solution code:
n,a,b = map(int,input().split())
def ten(i):
  wa = 0
  while i != 0:
     wa += i%10
     i = i//10
  return(wa)  

for i in range(n + 1):
  result = 0
  if a <= ten(i) and ten(i)<=b:
    result += i
print(result)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

N, A, B = list(map(int, input().split()))
total = 0
for i in range(1, N+1):
  if A <= findSumOfDigits(i) <= B:
    total += 1

print(total)

Submission status: Wrong Answer

Solution code:
n, a, b = list(map(int, input().split()))
res = 0
for i in range(1, n+1):
  sum = int(i/10000) + int(i%10000/1000) + int(i%1000/100) + int(i%100/10) + int(i%10)
  print(i, sum)
  if a <= sum and sum <= b:
    res += i

print(res)

Submission status: Wrong Answer

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

ans = 0
for i in range(n+1):
    sum = 0
    while(n > 0):
        sum += n % 10
        n /= 10 
    
        ans += sum

print(ans)

Submission status: Wrong Answer

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

for i in range(1, n+1):
    sum = i//(10**4) + i//(10**3) + i//(10**2) + i//10 + i
    if sum >=a and sum <=b:
        count += i

print(count)

Submission status: Wrong Answer

Solution code:
import numpy as np
n, a, b = map(int, input().split())
sum_i = 0
for i in range(n + 1):
  base = i
  v10000 = np.floor(base / 10000).astype(int)
  v1000 = np.floor((base - v10000 * 10000) / 1000).astype(int)
  v100 = np.floor((base - v1000 * 1000) / 100).astype(int)
  v10 = np.floor((base - v100 * 100) / 10).astype(int)
  v1 = base - (v10 * 10)
  sum_10_1 = v10 + v1
  if a <= sum_10_1 <= b:
    sum_i += i
print(sum_i)

Submission status: Wrong Answer

Solution code:
n,a,b = map(int,input().split())
l=[]
for i in range(1,n+1): #1からNまでの整数を全探索
    ic = list(str(int(i))) #整数を各桁リスト化
    s = list(map(int,ic))
    print(s,sum(s))
    if sum(s) >= a and sum(s) <= b:
        l.append(i)
print(sum(l))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N,A,B = (int(i) for i in input().split())
s = 0
for i in range(1, N+1):
    list_1 = [int(x) for x in list(str(i))]
    k = sum(list_1)
    if k >= A and k <= B:
        s += 1
print(s)

Submission status: Wrong Answer

Solution code:
N, A, B = map(int, input().split())
sum = 0
for n in range(N+1):
    if n >= 1 and n < 10 and n >= A and n <= B:
        sum+=n
    elif n >= 10 and n < 100 and (int(n/10) + n%10) >= A and (int(n/10) + n%10) <= B:
        sum+=n
    elif n >= 100 and n < 1000 and (int(n/100) + int((n%100)/10) + n%10) >= A and (int(n/100) + int((n%100)/10) + n%10) <= B:
        sum+=n
    elif n >= 1000 and n < 10000 and (int(n/1000) + int((n%1000)/100) + int((n%100)/10) + n%10) >= A and (int(n/1000) + int((n%1000)/100) + int((n%100)/10) + n%10) <= B:
        sum+=n
    elif n == 10000 and 1 < A and 1 < B:
        sum+=n

print(sum)

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)
    count = 0
    for j in range(len(s)):
        count += int(s[j])
    if count>=a and count<=b:
        ans +=1

print(ans)

Submission status: Wrong Answer

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

i=0
souwa=0
while i<=N:
  j=i
  sum =0
  while j>0:
    sum=sum+j%10
    j=round(j/10)
  #print(i,sum)
  if sum>=a and sum<=b:
    #print(i)
    souwa=souwa+i
  
  
  i=i+1
print(souwa)

Submission status: Wrong Answer

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

i=0
souwa=0
while i<N:
  j=i
  sum =0
  while j>0:
    sum=sum+j%10
    j=round(j/10)
  #print(i,sum)
  if sum>a and sum<b:
    souwa=souwa+sum
  
  
  i=i+1
print(souwa)

Submission status: Wrong Answer

Solution code:
from sys import stdin
N, A, B = [int(x) for x in stdin.readline().rstrip().split()]
n_list = [0]
digit3_max = min(int(N / 100), 9)

for digit3 in range(digit3_max + 1):
    tmp1 = N - digit3 * 100
    digit2_max = min(int(tmp1 / 10), 9)
    for digit2 in range(digit2_max + 1):
        tmp2 = tmp1 - digit2 * 10
        digit1_max = min(tmp2, 9)
        for digit1 in range(digit1_max + 1):
            if (digit1 + digit2 + digit3) >= A and (digit1 + digit2 + digit3) <= B:
                n_list.append(digit3 * 100 + digit2 * 10 + digit1)

print(sum(n_list))

Submission status: Wrong Answer

Solution code:
from sys import stdin
N, A, B = [int(x) for x in stdin.readline().rstrip().split()]
n_list = [0]
digit2_max = min(int(N / 10), 9)

for digit2 in range(digit2_max + 1):
    tmp1 = N - digit2 * 10
    tmp2 = min(tmp1, 9)
    for digit1 in range(tmp2 + 1):
        if (digit1 + digit2) >= A and (digit1 + digit2) <= B:
            n_list.append(digit2 * 10 + digit1)

print(sum(n_list))

Submission status: Wrong Answer

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

ans = []
for i in range(1,n+1):
    # i = 10
    n1 = i
    n2 = 0
    while n1 != 0:
        n2 += n1%10
        n1 = n1//10
    print(n2)
    if a <= n2 <= b:
        ans.append(i)
print(sum(ans))

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
def main():
    sN, sA, sB = input().split()
    N, A, B = int(sN), int(sA), int(sB)
    counter = 0

    for n in range(1, N+1):
        sum = int(n / 10) + n % 10
        if A <= sum and sum <= B:
            counter += n

    print(counter)


if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
 #ABC83, B - some sums

n, a, b = [int(el) for el in input().split(' ')]

total = 0
for i in range(1, n+1):
    some_sum = sum(divmod(i, 10))
    if a <= some_sum <= b:
        total += i
print(total)

Submission status: Wrong Answer

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

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

n = 0
for n in range(N+1):
        x = digitsum(n)
        if A <= x <= B:
                data.append(x)

print(sum(data))

Submission status: Wrong Answer

Solution code:
N, A, B = map(int, input().split())
sum = 0
 
for n in range(N+1):
  N1 = int(n/10000)
  N2 = int((n-10000*N1)/1000)
  N3 = int((n-10000*N1-1000*N2)/100)
  N4 = int((n-10000*N1-1000*N2-100*N3)/10)
  N5 = n--10000*N1-1000*N2-100*N3-10*N4
  if A <= N1+N2+N3+N4+N5 <= B:
    sum = sum + n
 
 
print(sum)

Submission status: Wrong Answer

Solution code:
N, A, B = map(int, input().split())
sum = 0
 
for n in range(N+1):
  N1 = int(n/10000)
  N2 = int((n-10000*N1)/1000)
  N3 = int((n-10000*N1-1000*N2)/100)
  N4 = int((n-10000*N1-1000*N2-100*N3)/10)
  N5 = n--10000*N1-1000*N2-100*N3-10*N4
  if A <= N1+N2+N3+N4+N5 <= B:
    sum = sum + n
 
print(N1)

Submission status: Wrong Answer

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

for n in range(N+1):
  N1 = int(n/10)
  N2 = n-10*N1
  if A <= N1+N2 <= B:
    sum = sum + n

print(sum)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n, a, b = map(int, input().split())
count = 0
for i in range(n+1):
    if i < 10:
        if  a  <= i <= b:
            count += i
    if i >= 10:
        if a <= int(str(i)[0]) + int(str(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):
    t4 = i %10
    t3 = (i %100 -t4) //10
    t2 = (i %1000 -t4 -t3*10) //100
    t1 = (i %10000 -t4 -t3*10 -t2*100) //1000
    c = t1 + t2 + t3 + t4
    if a <= c <= b: ans += i
if n == 10**4 and a == 1:
    ans += 1
print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
N,A,B=map(int,input().split())
counter=0
for i in range(N):
  n=str(i+1)
  s=len(n)
  n_total=0
  for t in range(s):
    n_total+=int(n[t])
  if A<= n_total <=B:
    counter+=1
print(counter)

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([int(c) for c in str(i)]) <= b:
        ans += 1
print(ans)

Submission status: Wrong Answer

Solution code:
import math

b = [int(e) for e in input().split()]
"""
n=input()
n=int(n)
a=input()
a=int(a)
b=input()
b=int(b)
"""
list = []
for i in range(b[0]+1):
    if(math.floor(i/1000)<10):
        x=math.floor(i/1000)
    if(math.floor(i/100)<10):
        x=x+math.floor(i/100)
    if(math.floor(i/10)<10):
        x=x+math.floor(i/10)
    x=x+i%10
    #x=math.floor(i/1000) +math.floor(i/100)+math.floor(i/10)+i%10
    
    if(x>=b[1] and x<=b[2]):
        list.append(i)

print(sum(list))
#print(list)

Submission status: Wrong Answer

Solution code:
import math

b = [int(e) for e in input().split()]
"""
n=input()
n=int(n)
a=input()
a=int(a)
b=input()
b=int(b)
"""
list = []
for i in range(b[0]+1):
    x=math.floor(i/1000)
    if(math.floor(i/100)<10):
        x=x+math.floor(i/100)
    if(math.floor(i/10)<10):
        x=x+math.floor(i/10)
    x=x+i%10
    #x=math.floor(i/1000) +math.floor(i/100)+math.floor(i/10)+i%10
    
    if(x>=b[1] and x<=b[2]):
        list.append(i)

print(sum(list))
#print(list)

Submission status: Wrong Answer

Solution code:
import math

b = [int(e) for e in input().split()]
"""
n=input()
n=int(n)
a=input()
a=int(a)
b=input()
b=int(b)
"""
list = []
for i in range(b[0]+1):
    x=math.floor(i/1000) +math.floor(i/100)+math.floor(i/10)+i%10
    #print(x)
    if(x>=b[1] and x<=b[2]):
        list.append(i)

print(sum(list))
#print(list)

Submission status: Wrong Answer

Solution code:
def sum_all(x):
  a = 0
  while x >= 10:
    a += x%10
    x = x/10
  a += x
  return int(a)
N, A, B = map(int, input().split())
ans_list = []
for i in range(1, N+1):
  if sum_all(i) >= A and sum_all(i) <= B:
    ans_list.append(i)
print(sum(ans_list))

Submission status: Wrong Answer

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

# まずN <= 10**4だからO(N)で間に合う
ans = 0
for i in range(1, N+1):
    num = 0
    if i < 10:  # 1桁
        num = i
    elif i < 10**2:
        ii = i
        for j in [10, 1]:
            a = ii // j
            num += a
            ii -= a * j
    elif i < 10**3:
        ii = i
        for j in [10**2, 10, 1]:
            a = ii // j
            num += a
            ii -= a * j
    elif i < 10**4:
        ii = i
        for j in [10**3, 10**2, 10, 1]:
            a = ii // j
            num += a
            ii -= a * j
    
    if A <= num and num <= B:
        ans += i

print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
n,a,b=map(int,input().split())
anssumsum=0
for i in range(n):
    num=i+1
    num10000=num//10000
    num1000=(num - num10000*10000)//1000
    num100=(num- num10000*10000-num1000*1000)//100
    num10=(num- num10000*10000-num1000*1000-num100*100)//10
    num1=num- num10000*10000-num1000*1000-num100*100-num10*10
    anssum=num1000+num100+num10+num1
    if (anssum>=a)&(anssum<=b):
        anssumsum=anssumsum+num
    #print(num1000,num100,num10,num1)
print(anssumsum)

Submission status: Wrong Answer

Solution code:
n,a,b=map(int,input().split())
anssumsum=0
for i in range(n+1):
    num=i+1
    num1000=num//1000
    num100=(num-num1000*1000)//100
    num10=(num-num1000*1000-num100*100)//10
    num1=num-num1000*1000-num100*100-num10*10
    anssum=num1000+num100+num10+num1
    if (anssum>=a)&(anssum<=b):
        anssumsum=anssumsum+num
print(anssumsum)

Submission status: Wrong Answer

Solution code:
n,a,b=map(int,input().split())
anssumsum=0
for i in range(n):
    num=i+1
    num1000=num//1000
    num100=(num-num1000*1000)//100
    num10=(num-num1000*1000-num100*100)//10
    num1=num-num1000*1000-num100*100-num10*10
    anssum=num1000+num100+num10+num1
    if (anssum>=a)&(anssum<=b):
        anssumsum=anssumsum+num
print(anssumsum)

Submission status: Wrong Answer

Solution code:
def someSums():
	n, a, b = map(int, input().split())
	count = 0
	for i in range(1, n + 1):
		sum = 0
		n = i
		while True:
			sum += n % 10
			if n >= 10:
				n = n // 10
			else:
				break
		if a <= sum and sum <= b:
			print(sum)
			count += i
	print(count)

someSums()

Submission status: Wrong Answer

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

y = 0
for i in range(n+1):
    x = 0
    j = i
    while j > 0:
        x += j % 10
        j /= 10
    if x >= a and x <= b:
        y += x
print(y)

Submission status: Wrong Answer

Solution code:
arr = list(map(int, input().split()))
au = sum(i for i in range(arr[0]) if arr[1] <= sum(map(int, str(i))) <= arr[2])
print(au)

Submission status: Wrong Answer

Solution code:
arr = list(map(int, input().split())) # 入力した数列をリストとして取得
su = 0
for i in range(1, arr[0]+1):
    a = i / 10000
    b = (i % 10000) / 1000
    c = ((i % 10000) % 1000) / 100
    d = (((i % 10000) % 1000) % 100) / 10
    e = i % 10
    total = a + b + c + d + e
    if arr[1] <= total <= arr[2]:
        su += i
print(su)

Submission status: Wrong Answer

Solution code:
arr = list(map(int, input().split())) # 入力した数列をリストとして取得
su = 0
for i in range(1, arr[0]+1):
    a = i / 10000
    b = (i % 10000) / 1000
    c = ((i % 10000) % 1000) / 100
    d = (((i % 10000) % 1000) % 100) / 10
    e = i % 10
    total = a + b + c + d + e
    if total >= arr[1] and total <= arr[2]:
        su += i
print(su)

Submission status: Wrong Answer

Solution code:
arr = list(map(int, input().split())) # 入力した数列をリストとして取得
su = 0
for i in range(1, arr[0]+1):
    a = i / 10000
    b = i / 1000 - a * 10
    c = i / 100 - a * 100 - b * 10
    d = i / 10 - a * 1000 - b * 100 - c * 10
    e = i % 10
    total = a + b + c + d + e
    if total >= arr[1] and total <= arr[2]:
        su += i
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 += 1
print(ans)

Submission status: Wrong Answer

Solution code:
# coding: utf-8
import time
import re
import math
import fractions

def main():
    N,A,B=map(int,input().split())
    count=0
    for a in range(1,N+1):
        s=str(a)
        total=0
        for b in s:
            total+=int(b)
        if A<=total and total<=B:
            count+=1
    print(count)
start=time.time()
main()
#print("処理速度 {}sec".format(time.time()-start))
#"YNeos"[True::2]
#A=list(map(int,input().split()))
#A,B,C=map(int,input().split())
#n=int(input())
# global n,A,s,memo,mx,mn,L,B

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 i in range(n+1):
        #print(i)
        if (a<= i//10000 + (i-i//10000*10000)//1000 + (i-i//1000*1000)//100 + (i-i//100*100)//10 + i%10 <=b):
            sum += i
"""
# 回答例　ひたすら10で割ってって、商が0になったらおわり
for i in range(n+1):
    i_sum = 0
    i_num = i
    print("i_num:"+str(i_num))
    while(True):
        if(i_num//10 ==0):
            i_sum += (i_num%10)
            break
        else:
            i_sum += (i_num%10)
            i_num = i_num//10
    if(a<= i_sum <= b):
        print(i_sum)
        sum += i
print("-------------------")
print(sum)


# じぶんのがスッキリだけど、10^4までしかつかえないので、アルゴリズムとしては解答例の方がいい

Submission status: Wrong Answer

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

sum = 0
for i in range(N+1):
    count = 0
    for num in str(i):
        count += int(num)

    if (count >= A) and (count <= B):
        sum += 1
print(sum)

Submission status: Wrong Answer

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

sum = 0
for i in range(N+1):
    count = 0
    for num in str(i):
        count += int(num)

    if (count >= A) and (count <= B):
        sum+=1
print(sum)

Submission status: Wrong Answer

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

sum = 0
for i in range(N+1):
    count = 0
    for num in str(i):
        count += int(num)

    if A <= count <= B:
        sum+=1
print(sum)

Submission status: Wrong Answer

Solution code:
N,A,B = map(int, input().split())
total = 0
for num in range(1,N):
    cnt = 0
    num_str = str(num)
    for i in num_str:
        cnt += int(i)
        if A <= cnt <= B:
            total += num

print(total)

Submission status: Wrong Answer

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

sum = 0
for i in range(1, N+1):
  if i < 10:
    if A <= i and i <= B:
        sum += i
  elif i < 100:
    temp = int(i/10) + i%10
    if A <= temp and temp <= B:
      sum += i
  elif i < 1000:
    temp = int(i/100) + int(i%100/10) + i%100%10
    if A <= temp and temp <= B:
      sum += i
  else:
    temp = int(i/1000) + int(i%1000/100) + int(i%1000%100/10) + i%1000%100%10
    if A <= temp and temp <= B:
      sum += i

print(sum)

Submission status: Wrong Answer

Solution code:
N,A,B = map(int, input().split())
total = 0
for num in range(1,N):
    cnt = 0
    num_str = str(num)
    for i in num_str:
        cnt += int(i)
        if A <= cnt <= B:
            total += cnt

print(total)

Submission status: Wrong Answer

Solution code:

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

sum = 0
for i in range(1, N+1):
  if i < 10:
    if A <= i and i <= B:
        sum += i
  elif i < 100:
    temp = int(i/10) + i%10
    print(temp)
    if A <= temp and temp <= B:
      sum += i
  elif i < 1000:
    temp = int(i/100) + int(i%100/10) + i%100%10
    if A <= temp and temp <= B:
      sum += i
  else:
    temp = int(i/1000) + int(i%1000/100) + int(i%1000%100/10) + i%1000%100%10
    if A <= temp and temp <= B:
      sum += i

print(sum)

Submission status: Wrong Answer

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

def sumdigit(num):
    sum=0
    for i in num:
        sum+=int(i)
    return sum

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

Submission status: Wrong Answer

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

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

total = 0
for number in range(1,N+1):
  all_sum = find_sum_of_digits(number)
  if A <= all_sum and all_sum <= B:
    total = total + number

print(total)

Submission status: Wrong Answer

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

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

total = 0
for number in range(1,N+1):
  all_sum = find_sum_of_digits(number)
  
  if A <= all_sum and all_sum <= B+1:
    total = total + number

print(total)

Submission status: Wrong Answer

Solution code:
N,A,B = map(int,input().split())
ans = 0
for i in range(1,N+1):
    Sen = i/1000
    hyaku = i/100%10
    juu = i/10%10
    ichi = i%10
    X = Sen+hyaku+juu+ichi
    if A<=X<=B:
        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 A <= sum(list(map(int, list(str(i))))) <= 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):
    if A <= sum(map(int, list(str(i)))) <= B:
        ans += 1
print(ans)

Submission status: Wrong Answer

Solution code:
s = input().split()
N = int(s[0])
A = int(s[1])
B = int(s[2])
k = 0
for i in range(1,N+1):
  S = 0
  while i >= 1:
    p = i%10
    i = i//10
    S = S + p
  if A <= S <= B:
    k = k + i
print(k)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

def calsum(x):
    a = x // 10000
    b = (x-1000*a) // 1000
    c = (x-1000*a-1000*b) // 100
    d = (x-1000*a-1000*b-100*c) // 10
    e = (x-1000*a-1000*b-100*c-10*d)
    return a+b+c+d+e
ans = 0
for i in range(N+1):
    if A <= calsum(i) and calsum(i) <= B:
        ans += i
print(ans)

Submission status: Wrong Answer

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

def calsum(x):
    a = x // 10000
    b = (x-1000*a) // 1000
    c = (x-1000*a-1000*b) // 100
    d = (x-1000*a-1000*b+100*c) // 10
    e = (x-1000*a-1000*b+100*c-10*d)
    return a+b+c+d+e
ans = 0
for i in range(N+1):
    if A <= calsum(i) and calsum(i) <= B:
        ans += i
print(ans)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

Solution code:
def check(i,A,B):
    k = 0
    for j in range(len(str(i))):
        k += i % 10
        i = int(i/10)
    if k >= A and k <= B:
        return 1
    else:
        return 0

N,A,B = map(int,input().split())
num = 0
for i in range(N + 1):
    c = check(i,A,B)
    if c == 1:
        print(i)
        num += i
print(num)

Submission status: Wrong Answer

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

Submission status: Wrong Answer

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

def add(n,a,b):
    ls = list(str(n))
    pl = sum([int(i) for i in ls])
    if a<= pl<= b:
        return 1
    else:
        return 0

flg = 0
for i in range(n+1):
    flg += add(i,a,b)

print(flg)