#ABC154E. Almost Everywhere Zero

Almost Everywhere Zero

题目描述

Find the number of integers between 11 and NN (inclusive) that contains exactly KK non-zero digits when written in base ten.

求在 11NN (含)之间的整数中,以十为底数书写时正好包含 KK 个非零数字的整数个数。

输入格式

输入内容按以下格式标准输入:

NN
KK

输出格式

打印计数。

样例 #1

样例输入 #1

100
1

样例输出 #1

19

样例 #2

样例输入 #2

25
2

样例输出 #2

14

样例 #3

样例输入 #3

314159
2

样例输出 #3

937

样例 #4

样例输入 #4

9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999
3

样例输出 #4

117879300

说明

数据规模与约定

  • 1N<101001 \leq N \lt 10^{100}
  • 1K31 \leq K \leq 3

样例 11 解释

下列 1919 个整数满足条件:

  • 1,2,3,4,5,6,7,8,9,10,20,30,40,50,60,70,80,90,1001,2,3,4,5,6,7,8,9,10,20,30,40,50,60,70,80,90,100

样例 22 解释

下列 1414 个整数满足条件:

  • 11,12,13,14,15,16,17,18,19,21,22,23,24,2511,12,13,14,15,16,17,18,19,21,22,23,24,25