uestc oj 1793 Kalindrome

     
Description
A palindromic number is a number that remains the same when its digits are reversed.
 Like 16461, for example, it is "symmetrical".

Now Krolia want to know the Kth-largest palindromic number which is smaller than n.

Input
There is only one integer T(T<=100) in the first line, indicating the number of test cases.

Every test cases contains two integers n(0<=n<=10^100),k(1<=k<=100).
Output
For every test cases, just output a the kth-largest palindromic number in one line.
 If this number doesn't exist, output -1.
Sample Input
5
10 1
1 1
1 2
100 1
112 2

Sample Output
9
0
-1
99
101

Source
KroliaFansClub



这是一道关于数论的题目  题目要求给定一个0<=n<=10^100之间的数n及k ,求小于此数的第K大对称数(比如16461)

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值