• [J] Just a String

  • 时间限制: 2000 ms 内存限制: 32768 K
  • 问题描述
  • 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)
  • 输入
  • 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)
  • 输出
  • For each test cases, output the K-th alphabet order substring.
  • 样例输入
  • 2
    ABC 2
    BBC 3
    
  • 样例输出
  • Case 1: AB
    Case 2: BB
    
  • 提示
  • 来源
  • HyperHexagon’s Summer Day Gift
  • 操作

显示春菜