栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 软件开发 > 后端开发 > C/C++/C#

B - New String(string)

C/C++/C# 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

B - New String(string)

SDUT 2022 Spring Individual Contest(for 21) - 9 - Virtual Judge

ou are given nn strings and a new rule of overload the less-than sign, please print the KK-th lexicographically smallest string.

Every string contains only lowercase letters.

A string aa is lexicographically smaller than a string bb if and only if one of the following holds:

  • there exists a position ii, a_i < b_iai​
  • for every ii, a_i=b_iai​=bi​ and the length of aa is less than the length of bb.

Input

The first line gives 2626 characters from aa to zz, each character will appear only once. The earlier a letter appears, the smaller it is. For example, acb cdots xyzacb⋯xyz in the first line means that character 'cc' is less than character 'bb' and character 'cc' is greater than character 'aa'.

The second line contains an integer nn (1 < n < 10^3)(1

Next nn lines, each line contains a string, whose length of the string is less than 10^3103.

The next line contains an integer KK (1 leq K leq n)(1≤K≤n), indicating the KK-th smallest string you need to find.

Output

The KK-th lexicographically smallest string.

Sample 1

InputcopyOutputcopy
acbdefghijklmnopqrstuvwxyz
2
abc
acb
1
acb

Sample 2

InputcopyOutputcopy
zabcdefghijklmnopqrstuvwxy
2
a
b
1
a

#include
using namespace std;
int mp[1010];//比较大小
string v[1010];
bool cmp(string s,string p)
{
    int n=s.size();
    int m=p.size();
    for(int i=0,j=0;imp[p[j]])return false;
    }
    if(n 

虽说是一题签到题,但string的用法不熟练,记录一下

转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/947886.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号