编程介的小学生 2019-06-18 20:20 采纳率: 20.5%
浏览 185

计算地K个字母表上的子字符串的顺序,怎么用C语言的程序的编写的代码来实现寻找这个字符串的

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条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥20 双层网络上信息-疾病传播
    • ¥50 paddlepaddle pinn
    • ¥20 idea运行测试代码报错问题
    • ¥15 网络监控:网络故障告警通知
    • ¥15 django项目运行报编码错误
    • ¥15 请问这个是什么意思?
    • ¥15 STM32驱动继电器
    • ¥15 Windows server update services
    • ¥15 关于#c语言#的问题:我现在在做一个墨水屏设计,2.9英寸的小屏怎么换4.2英寸大屏
    • ¥15 模糊pid与pid仿真结果几乎一样