P1554 [USACO06DEC] Dream Counting B
Background
Bessie is half asleep. After a while, she realizes she is counting and cannot fall asleep.
Description
Bessie's mind is sharp, as if she vividly sees each number she has counted. She starts to pay attention to every digit ($0 \ldots 9$): how many times does each digit appear during the counting process?
Given two integers $M$ and $N$, determine how many times each digit appears in the sequence $[M, M + 1, M + 2, \ldots, N - 1, N]$.
Input Format
Line $1$: Two integers $M$ and $N$ separated by a space.
Output Format
Line $1$: Ten integers separated by spaces, representing how many times the digits $0 \ldots 9$ appear in the sequence.
Explanation/Hint
Constraints: $1 \leq M \leq N \leq 2 \times 10^9$, $0 \leq N - M \leq 5 \times 10^5$.
Translated by ChatGPT 5