题目很水 不多贴了
问题 D: Team Name
时间限制: 1 Sec 内存限制: 128 MB提交: 48 解决: 29
[提交] [状态] [讨论版] [命题人:admin]
题目描述
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].
输入
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.
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.
输出
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.
There should be one string in the line which means the name Luras will give to her team.
样例输入
2
3
a
b
c
2
abcdefghijklmnopqrstuvwxyz
aa
样例输出
d
ac
#include <bits/stdc++.h> using namespace std; int n; char a[105][35]; char ans[105]; bool flag; void dfs(int dep,int len) { if(len==dep) { ans[len++] = '