HDU - 2018杭电ACM集训队单人排位赛 - 2 - Problem D. Team Name
发布日期:2021-06-30 23:40:34
浏览次数:4
分类:技术文章
本文共 1830 字,大约阅读时间需要 6 分钟。
Problem D Team Name
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 129 Accepted Submission(s): 68
Problem Description
After all the teams have been matched, what to do next is of course to think about a nice team name. Now it is known that there are n teams taking part in the Guangxi Province Collegiate Programming Contest. And the name of every team is a string consists of English lower characters. Now Luras needs to get her team name, she doesn’t want the name be any consecutive substring of any other teams. And she prefers shorter names. If there are many choices with the shortest length, she would prefer the one which is the smallest lexicographically. Now could you decide the team name for her? We regard string a is lexicographically smaller than string b if there exists such index j that a[i] == b[i] for all i < j and a[j] < b[j].
Input
The first line is an integer T which indicates the case number. And as for each case, there will be n + 1 lines. In the first line, there is one integer n, which indicates the number of teams. Then there will be n strings of the next n lines, indicate the name of every team in each line. It is guaranteed that—— T is about 100. for 100% cases, 1 <= n <= 100, 1 <= |s|(the length of s)<= 30.
Output
As for each case, you need to output a single line. There should be one string in the line which means the name Luras will give to her team.
Sample Input 23abc2abcdefghijklmnopqrstuvwxyzaa
Sample Output d
ac
解题思路:不是 n 个队名中的子串 && 队名字典序尽可能小。
AC 代码
#include#include #define mem(a,b) memset(a,b,sizeof a);#define INF 0x3f3f3f3fusing namespace std;typedef long long ll;char a[110][110], ans[110];bool ok;int n;void dfs(int dep,int len){ if(len==dep) { ans[len++]='\0'; for(int i=0;i
转载地址:https://lux-sun.blog.csdn.net/article/details/81061578 如侵犯您的版权,请留言回复原文章的地址,我们会给您删除此文章,给您带来不便请您谅解!
发表评论
最新留言
逛到本站,mark一下
[***.202.152.39]2024年04月30日 08时54分24秒
关于作者
喝酒易醉,品茶养心,人生如梦,品茶悟道,何以解忧?唯有杜康!
-- 愿君每日到此一游!
推荐文章
如何在MAC机器中实现移动设备WiFI上网(没有专门的无线路由器的情况)
2019-05-01
从零开始安装Hadoop视频教程
2019-05-01
一款非常实用的在线代码分享站点
2019-05-01
教你一分钟制作自己的电子书(视频)
2019-05-01
用ipad维护Linux服务器
2019-05-01
如何用手机维护Mysql数据库
2019-05-01
企业内网信息安全实践-记ChinaUnix技术交流
2019-05-01
完成《Java编程入门》初稿
2019-05-01
Windows Server 2012下安装Hyper-V虚拟机
2019-05-01
MacOSX和Windows 8的完美融合
2019-05-01
Iphone5S 体验(视频+截图)
2019-05-01
python 多进程之进程池的操作
2019-05-01
flask入门学习之第一个程序及装饰器回顾
2019-05-01
flask整理之 flask程序中的debug模式
2019-05-01
如何和大妈解释区块链,让他们理解区块链
2019-05-01
比特币要出现夭折?或许会出现转折
2019-05-01
比特币,山寨币,到底谁占有主导地位
2019-05-01
比特币,父母这一辈能接受吗?
2019-05-01