Submit | All submissions | Best solutions | Back to list |
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
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/ |
hide comments
|
|||||
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. |
|||||
2016-12-12 22:31:28 gimnazija zenica
274B in C |
|||||
2015-06-26 17:03:16 Soma
@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 Edit--: accepted. Note : the input ends when min(a,b)==0, the constraints are wrong. @author : nice problem+nice source limit. Last edit: 2015-07-01 17:52:23 |
|||||
2014-10-03 22:40:04 programmer
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. |
|||||
2014-05-30 19:53:17 Linghui Liu
@RIVU DAS , 217 bytes :P RE(Rivu) - Awesome man!! :) Last edit: 2014-06-10 16:00:33 |
|||||
2014-05-19 21:57:36 RIVU DAS
That was one hell of a problem!!Kudos to the problem setter!! :) 282 bytes OMG!! Now i got it to 278 bytes :) Last edit: 2014-05-30 16:51:17 |
|||||
2013-05-19 19:29:46 (Tjandra Satria Gunawan)(曾毅昆)
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). |
|||||
2013-05-19 18:45:12 (Tjandra Satria Gunawan)(曾毅昆)
constraints are incorrect, I found case with a=0 and b!=0 in your input data.. please fix this.. or update problem description.. And I got AC if I assume input end with a=0.. but b!=0 By the way, nice source limit, my code is 284B :-) I can't use fast I/O here.. Last edit: 2013-05-19 18:51:28 |
|||||
2013-05-10 18:00:04 Xsquare
why is source limit so less? |
|||||
2013-05-10 11:44:21 Mohamed
دى مسألة تحطها يا مؤمن :D :D :D >> اه :D Last edit: 2013-05-11 22:51:43 |