AtCoder Beginner Contest 208
E
Digit Products
AtCoder
⌀ 2024
原题
← DF →
翻译中…

Problem Statement

翻译中…

For how many positive integers at most $N$ is the product of the digits at most $K$?

翻译中…

Constraints

翻译中…
  • $1 \leq N \leq 10^{18}$
  • $1 \leq K \leq 10^9$
  • All values in input are integers.
翻译中…

Input

翻译中…

Input is given from Standard Input in the following format:

翻译中…

N K

翻译中…

Output

翻译中…

Print the number of integers satisfying the condition.

翻译中…

样例

Input #1
13 2
Output #1
5
Out of the positive integers at most $13$, there are five such that the product of the digits is at most $2$: $1$, $2$, $10$, $11$, and $12$.
Input #2
100 80
Output #2
99
Out of the positive integers at most $100$, all but $99$ satisfy the condition.
Input #3
1000000000000000000 1000000000
Output #3
841103275147365677
Note that the answer may not fit into a $32$-bit integer.
题目信息
题号
abc208_e
时间限制
2 s
内存限制
1024 MB

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