编程介的小学生 2020-01-27 21:56 采纳率: 20.5%
浏览 174

Just a String 字符串的一个问题

Problem Description
A substring of a string is a successive part of the string. Given a string your task is to find out the K-th alphabet order substring of the original string.
For example, the string "ABC" contains six substrings:
"A" "AB" "ABC" "B" "BC" "C" (in alphabet order)
and string "BBC" also contains six substrings:
"B" "B" "BB" "BBC" "BC" "C" (in alphabet order)

Input
The input contains several test cases, the first line of input contains the number of test cases.
For each test case, there is only one line contains the string S of length N, followed by a integer K. (1 <= K <= N*(N+1)/2, 1 <= N <= 100000, S contains only letters and digits)

Output
For each test cases, output the K-th alphabet order substring.

Sample Input
2
ABC 2
BBC 3

Sample Output
Case 1: AB
Case 2: BB

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 HFSS 中的 H 场图与 MATLAB 中绘制的 B1 场 部分对应不上
    • ¥15 如何在scanpy上做差异基因和通路富集?
    • ¥20 关于#硬件工程#的问题,请各位专家解答!
    • ¥15 关于#matlab#的问题:期望的系统闭环传递函数为G(s)=wn^2/s^2+2¢wn+wn^2阻尼系数¢=0.707,使系统具有较小的超调量
    • ¥15 FLUENT如何实现在堆积颗粒的上表面加载高斯热源
    • ¥30 截图中的mathematics程序转换成matlab
    • ¥15 动力学代码报错,维度不匹配
    • ¥15 Power query添加列问题
    • ¥50 Kubernetes&Fission&Eleasticsearch
    • ¥15 報錯:Person is not mapped,如何解決?