Problem H
Count the Numbers
Input: standard input
Output: standard output
Time
Limit: 2 seconds
You're
given three non-negative integers N (0 <= N <= 999), A, B,
(0 <= A <= B <= 2000000000). Count the number of integers in
the interval [A; B] which contain N as a subsequence.
For example if N = 3, A = 3 and B = 17, there are two integers which contain N as a subsequence: 3 and 13.
The input
contains triples of numbers A, B and N. The input ends
with "-1 -1 -1". This line should not be processed.
For each
triple, output the answer on a new line.
3
17 3 |
2 |
Author: Slavi Marinov
Translation and solution: Petko Minkov