Codeforces Round 249 (Div. 2)
翻译中…
Pasha has a positive integer $*a*$ without leading zeroes. Today he decided that the number is too small and he should make it larger. Unfortunately, the only operation Pasha can do is to swap two adjacent decimal digits of the integer.
翻译中…
Help Pasha count the maximum number he can get if he has the time to make at most $*k*$ swaps.
翻译中…
Input
翻译中…
The single line contains two integers $*a*$ and $*k*$ $(1 ≤ *a* ≤ 10^{18}; 0 ≤ *k* ≤ 100)$.
翻译中…
Output
翻译中…
Print the maximum number that Pasha can get if he makes at most $*k*$ swaps.
翻译中…
样例
Input #1
1990 1
Output #1
9190
InputCopy
OutputCopy
Input #2
300 0
Output #2
300
InputCopy
OutputCopy
Input #3
1034 2
Output #3
3104
InputCopy
OutputCopy
Input #4
9090000078001234 6
Output #4
9907000008001234
InputCopy
OutputCopy
题目信息
标签
贪心
题面与样例版权归 Codeforces 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。