标签:arc graphic 注意 div input The and letters 字符
题目
You are given a string s. Among the different substrings of s, print the K-th lexicographically smallest one.
A substring of s is a string obtained by taking out a non-empty contiguous part in s. For example, if s = ababc
, a
, bab
and ababc
are substrings of s, while ac
, z
and an empty string are not. Also, we say that substrings are different when they are different as strings.
Let X=x1x2…xn and Y=y1y2…ym be two distinct strings. X is lexicographically larger than Y if and only if Y is a prefix of X or xj>yj where j is the smallest integer such that xj≠yj.
Constraints
Partial Score
Input
Input is given from Standard Input in the following format:
s
K
Output
Print the K-th lexicographically smallest substring of K.
题目大意
给你一个字符串s,求它字典序第k大的字串
分析
因为k<=5,所以我们可以枚举字串的起始点和长度,以为长度小,我们把整个字串转化成数字然后排序即可,注意长度不满k的字串在末尾要补零
代码
标签:arc graphic 注意 div input The and letters 字符
原文地址:https://www.cnblogs.com/yzxverygood/p/9068423.html