编程介的小学生
2017-09-17 09:10Amusing Numbers
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
- 点赞
- 回答
- 收藏
- 复制链接分享
1条回答
为你推荐
- 数据结构之ZOJ——Exploding CPU
- testing
- zoj
- cpu
- 硬件
- 1个回答
- Interesting Yang Yui Triangle
- lines
- as
- it
- yui
- class
- 1个回答
- Experiment on a … “Cable”
- lines
- less
- 1个回答
- Exploding CPU
- 硬件
- 1个回答
- Amusing Numbers
- numbers
- 2个回答
换一换