CF1297G.M-numbers

普及/提高-

通过率:0%

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

For a given positive integer mm , a positive number is called a mm -number if the product of its digits is mm . For example, the beginning of a series of 2424 -numbers are as follows: 3838 , 4646 , 6464 , 8383 , 138138 , 146146 , 164164 , 183183 , 226226 ...

You are given a positive integer mm and kk . Print kk -th among mm -numbers if all mm -numbers are sorted in ascending order.

输入格式

A single line of input contains two integers mm and kk ( 2m1092 \le m \le 10^9 , 1k1091 \le k \le 10^9 ).

输出格式

Print the desired number — kk -th among all mm -numbers if mm -numbers are sorted in ascending order. If the answer does not exist, print -1.

输入输出样例

  • 输入#1

    24 9

    输出#1

    226
  • 输入#2

    24 1

    输出#2

    38
  • 输入#3

    5040 1000000000

    输出#3

    111121111315213227111
  • 输入#4

    2020 2020

    输出#4

    -1
首页