21768_Thek-thStringsequence

2022-5-16 18:20| 发布者: Hocassian| 查看: 25| 评论: 0|原作者: 肇庆学院ACM合集

摘要:
C:\Users\Administrator\Downloads\2019-10-12-10-14-4-89505829651500-Problem List-采集的数据-后羿采集器.html

Pro.ID

21768

Title

The k-th String sequence

Title链接

http://10.20.2.8/oj/exercise/problem?problem_id=21768

AC

0

Submit

0

Ratio

-

时间&空间限制

  • Time Limit: 2000/1000 MS (Java/Others)     Memory Limit: 65536/32768 K (Java/Others)
  • 描述

    Given a String s, we will first collect all distinct positive length subsequences of s, and place them in a list L. A subsequence of s is obtained by deleting 0 or more characters. Next, sort L into ascending order by length. Where ties occur, break them lexicographically. Here uppercase letters occur before lowercase letters. Finally, return the String in position k % TOTAL (0-based), where TOTAL is the number of elements in L.

    输入

    Line 1: The input contains a single integer T , the number of test cases.

    Line 2...T+1: s  k (The input string s and the position of the output string).

    (The length of s is between 2 and 50. Each character in s will be a letter ('A'-'Z','a'-'z'). k will be an integral value between 0 and 263 - 1 inclusive. ).

    输出

    Description

    Given a String s, we will first collect all distinct positive length subsequences of s, and place them in a list L. A subsequence of s is obtained by deleting 0 or more characters. Next, sort L into ascending order by length. Where ties occur, break them lexicographically. Here uppercase letters occur before lowercase letters. Finally, return the String in position k % TOTAL (0-based), where TOTAL is the number of elements in L.

    Input

    Line 1: The input contains a single integer T , the number of test cases.

    Line 2...T+1: s  k (The input string s and the position of the output string).

    (The length of s is between 2 and 50. Each character in s will be a letter ('A'-'Z','a'-'z'). k will be an integral value between 0 and 263 - 1 inclusive. ).

    Output

    Line 1...T: Output the string for each test case.

    Sample Input

    3
    ABCD 15
    ABCD 14
    AbcdAbcdAbcd 39283423984923

    Sample Output

    A
    ABCD
    AbAbdbd

    Source

    样例输入

    3
    ABCD 15
    ABCD 14
    AbcdAbcdAbcd 39283423984923

    样例输出

    A
    ABCD
    AbAbdbd

    作者


    路过

    雷人

    握手

    鲜花

    鸡蛋

    最新评论

    返回顶部