5485: 计数问题

Memory Limit:128 MB Time Limit:1.000 S
Judge Style:Text Compare Creator:
Submit:27 Solved:25

Description

试计算在区间 11 到 nn的所有整数中,数字x(0 ≤ x ≤ 9)共出现了多少次?例如,在 1到 11中,数字1出现了4次。

Input

2个整数n,x,之间用一个空格隔开。

Output

1个整数,表示x出现的次数。

Sample Input Copy

11 1

Sample Output Copy

4

HINT

对于 100%的数据,1≤ n ≤ 1,000,000,0 ≤ x ≤ 9

Source/Category