#G. E - Digit Products

    传统题 1000ms 256MiB

E - Digit Products

该比赛已结束,您无法在比赛模式下递交该题目。您可以点击“在题库中打开”以普通模式查看和递交本题。

E - Digit Products

Score : $500$ points

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:

NN KK

Output

Print the number of integers satisfying the condition.


13 2
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$.


100 80
99

Out of the positive integers at most $100$, all but $99$ satisfy the condition.


1000000000000000000 1000000000
841103275147365677

Note that the answer may not fit into a $32$-bit integer.

2024春季入门组刷题营(十)

未参加
状态
已结束
规则
IOI
题目
8
开始于
2024-5-19 13:00
结束于
2024-5-19 15:00
持续时间
2 小时
主持人
参赛人数
10