#P1980. [NOIP 2013 普及组] 计数问题

[NOIP 2013 普及组] 计数问题

Description

Compute how many times the digit xx (0x90 \le x \le 9) appears among all integers from 11 to nn. For example, among 11 to 1111, i.e., in 1,2,3,4,5,6,7,8,9,10,111, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, the digit 11 appears 44 times.

Input Format

Two integers nn and xx, separated by a single space.

Output Format

One integer, representing the number of times xx appears.

11 1
4

Hint

For 100%100\% of the testdata, 1n1061 \le n \le 10^6, 0x90 \le x \le 9.

Translated by ChatGPT 5