count
Let's take all the positive integers of closed interval [a, b], 0<a<b<10000000.
Task Write a program that calculates the number of times each digit, 0, 1, 2, ..., 9, appears in the numbers of the given interval.
Input Data Input file count.in will consist of a single line with positive integers a and b separated by a space.
Output Data Output file count.out will consist of a single line with 10 positive integers separated by a space, representing the number of times the 10 digits appear in the numbers of given interval [a, b], in the following order: the first number represents the number of times 0 appears, the second represents the number of times 1 appears, ..., and the last number representing the number of times 9 appears.
Restrictions
0<a<b<10000000
Examples
count.in |
count.out |
Explanations |
1 10 |
1 2 1 1 1 1 1 1 1 1 |
1 0, 2 1s, 1 2, ..., 1 9 |
346 542 |
40 40 40 93 136 82 40 40 40 40 |
40 0s, 40 1s, 40 2s, ..., 40 9s |
1199 1748 |
115 666 215 215 214 205 205 154 105 106 |
115 0s, 666 1s, 215 2s, ..., 106 9s |
1403 1496 |
16 113 19 20 114 20 20 19 19 16 |
16 0s, ..., 16 9s |
503 1004 |
107 105 100 101 101 197 200 200 200 200 |
107 0s, ..., 200 9s |
190 1714 |
413 1133 503 503 503 502 502 417 402 412 |
413 0s, ..., 412 9s |
854 1317 |
196 512 186 104 87 93 97 97 142 196 |
196 0s, ..., 196 9s |
494 1976 |
398 1375 398 398 405 499 499 495 488 471 |
398 0s, ..., 471 9s |
1001 1960 |
294 1256 296 296 296 296 287 286 286 247 |
294 0s, ..., 247 9s |
44 497 |
85 185 185 185 190 96 96 96 95 93 |
85 0s, 185 1s, ..., 93 9s |
Time limit: 0.5 seconds/test
Marinel Serban "Gr. C. Moisil" Iaşi IT High School
marinel_serban@yahoo.com
|