1708: [noip2013普及组]记数问题

Memory Limit:128 MB Time Limit:1.000 S
Judge Style:Text Compare Creator:
Submit:59 Solved:53

Description

  试计算在区间1 到n 的所有整数中,数字x(0 ≤ x ≤ 9)共出现了多少次?例如,在1
到11 中,即在1、2、3、4、5、6、7、8、9、10、11中,数字1 出现了4 次。

 

Input

输入文件名为count.in。
输入共1行,包含 2个整数n、x,之间用一个空格隔开。
 

Output

输出文件名为count.out。
输出共1行,包含一个整数,表示 x出现的次数。

Sample Input Copy

11 1 

Sample Output Copy

4

HINT

【数据说明】
对于100%的数据,1≤ n ≤ 1,000,000,0 ≤ x ≤ 9。

Source/Category