DIGCNT - digit count
Given two integers a and b, we write the numbers between a and b, inclusive, in a list. Your task is to calculate the number of occurrences of each digit except zero.
For example, if a = 1024 and b = 1032, the list will be 1024, 1025, 1026, 1027, 1028, 1029, 1030, 1031, 1032. There are ten 1s, seven 2s, three 3s, etc.Input
The input consists of up to 500 lines. Each line contains two numbers a and b, where 1 <= a, b <= 10^16. The input terminates when a is 0.
Output
For each pair of input, output a line containing ten numbers separated by single spaces. The first number is the number of occurrences of the digit 1, the second is the number of occurrences of the digit 2, etc.Example
input 1 10 0 0 output 2 1 1 1 1 1 1 1 1
hide comments
rising_stark:
2021-03-29 12:16:55
I have a digit dp solution but sadly I can't submit it due to the source limit restriction. After trying everything to shorten my code, I have reached 600B but not able to go below than that. |
|
gimnazija zenica:
2016-12-12 22:31:28
274B in C |
|
Soma:
2015-06-26 17:03:16
@author : can you check my code or tell for what kind of test cases my program fails. i am getting WA. i have checked with brute force algorithm and it is giving correct answer. code id:14546867
|
|
programmer:
2014-10-03 22:40:04
Had to do serious staring at the code. Finally got it. Exactly 290 bytes.As already mentioned in the comments, input ends "if a=0 irrespective of b". Please update accordingly. |
|
Linghui Liu:
2014-05-30 19:53:17
@RIVU DAS , 217 bytes :P
|
|
RIVU DAS:
2014-05-19 21:57:36
That was one hell of a problem!!Kudos to the problem setter!! :) 282 bytes
|
|
(Tjandra Satria Gunawan)(曾毅昆):
2013-05-19 19:29:46
Woohoo! Finally 0.00s after some opti.. and my code now 289B (1B less than source limit), congratulations, I'll recommend your problem in TJANDRA page soon (when I update it). |
|
(Tjandra Satria Gunawan)(曾毅昆):
2013-05-19 18:45:12
constraints are incorrect, I found case with a=0 and b!=0 in your input data.. please fix this.. or update problem description..
|
|
Xsquare:
2013-05-10 18:00:04
why is source limit so less? |
|
Mohamed:
2013-05-10 11:44:21
دى مسألة تحطها يا مؤمن
|
Added by: | abdou_93 |
Date: | 2013-05-08 |
Time limit: | 1s |
Source limit: | 290B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Languages: | All except: ASM64 |
Resource: | another version of http://www.spoj.com/problems/MDIGITS/ |