106 - ZOJ Monthly, May 2011 - F
You are given yet another set of numbers. The numbers in this set obey these rules:
Given a number B belonging to this set, you have to find out the number A such that there are exactly K-1 numbers larger than A and smaller than B in this set.
Input contains multiple test cases.
The first line of each test case contains two integers 0 < N < 20 and K > 0. The second line contains only a number B. It's guaranteed that the solution exists
For each case, output the number A in a single line.
2 5 3 5 50 12301
HintIn the first case, there are 12 numbers in the set. And they are sorted in following order:
1 < 10 < 12 < 13 < 2 < 20 < 21 < 23 < 3 < 30 < 31 < 32
Author: MO, Luyi