22670_AmusingNumbers

2022-5-16 18:22| 发布者: Hocassian| 查看: 27| 评论: 0|原作者: 肇庆学院ACM合集

摘要:
C:\Users\Administrator\Downloads\2019-10-12-10-14-5-89506840398499-Problem List-采集的数据-后羿采集器.html

Pro.ID

22670

Title

Amusing Numbers

Title链接

http://10.20.2.8/oj/exercise/problem?problem_id=22670

AC

0

Submit

1

Ratio

0.00%

时间&空间限制

  • Time Limit: 1500/500 MS (Java/Others)     Memory Limit: 65536/65536 K (Java/Others)
  • 描述

    Let us consider the set of integer numbers between 1 and N inclusive. Let us order them lexicographically (i. e. like in the vocabulary), for example, for N = 11 the order would be: 1, 10, 11, 2, 3, 4, 5, 6, 7, 8, 9.

    Let us denote the position of the number K in this ordering as QN,K. For example, Q11,2 = 4. Given numbers K and M find the smallest N such that QN,K = M.

    输入

    Input contains two integer numbers K and M ( 1 ≤ K, M ≤ 109 ) separated by a space.

    输出

    Description

    Let us consider the set of integer numbers between 1 and N inclusive. Let us order them lexicographically (i. e. like in the vocabulary), for example, for N = 11 the order would be: 1, 10, 11, 2, 3, 4, 5, 6, 7, 8, 9.

    Let us denote the position of the number K in this ordering as QN,K. For example, Q11,2 = 4. Given numbers K and M find the smallest N such that QN,K = M.

    Input

    Input contains two integer numbers K and M ( 1 ≤ K, M ≤ 109 ) separated by a space.

    Output

    If such N that QN,K = M exists then write to the output the smallest such N, otherwise write 0.

    Sample Input

    100000001 1000000000

    Sample Output

    100000000888888879

    Source

    样例输入

    100000001 1000000000

    样例输出

    100000000888888879

    作者


    路过

    雷人

    握手

    鲜花

    鸡蛋

    最新评论

    返回顶部