AtCoder Beginner Contest 154
E
Almost Everywhere Zero
AtCoder
⌀ 1298
原题
← DF →
翻译中…

Problem Statement

翻译中…

Find the number of integers between $1$ and $N$ (inclusive) that contains exactly $K$ non-zero digits when written in base ten.

翻译中…

Constraints

翻译中…
  • $1 \leq N < 10^{100}$
  • $1 \leq K \leq 3$
翻译中…

Input

翻译中…

Input is given from Standard Input in the following format:

翻译中…

N
K

翻译中…

Output

翻译中…

Print the count.

翻译中…

样例

Input #1
100
1
Output #1
19
The following $19$ integers satisfy the condition: - $1,2,3,4,5,6,7,8,9,10,20,30,40,50,60,70,80,90,100$
Input #2
25
2
Output #2
14
The following $14$ integers satisfy the condition: - $11,12,13,14,15,16,17,18,19,21,22,23,24,25$
Input #3
314159
2
Output #3
937
Input #4
9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999
3
Output #4
117879300
题目信息
题号
abc154_e
时间限制
2 s
内存限制
1024 MB

题面与样例版权归 AtCoder 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。