当前你的浏览器版本过低,网站已在兼容模式下运行,兼容模式仅提供最小功能支持,网站样式可能显示不正常。
请尽快升级浏览器以体验网站在线编辑、在线运行等功能。

建议使用的浏览器:

谷歌Chrome 火狐Firefox Opera浏览器 微软Edge浏览器 QQ浏览器 360浏览器 傲游浏览器

1734:Power Word

题目描述
Recently, loneknight is interesting in investigating the power of word. After several weeks of research, He recognize that there are some magic words in the world, if a word contains a magic word as its substring, it will have magic power. For example, if the word 'magic' is magic word, then the word 'magic', 'amagic', 'xxmagic', 'magiczz' are all power words.

In addition to this finding, he also find that the index of a powerword has a important impact on the power of word. The index of a power word define as follow: given the set of magic words, if we list all the powerword contain one or more magic word as substring in a list lexicographically from short length to long, the curring position of a word in the list is its index. So, if the magic words are 'magic' and 'hello', then word have index 1 is 'hello', the word have index 2 is 'magic', the word have index 3 is 'ahello' ... (only consider the lowercase words) .

Now, loneknight have find a way to calculate the the indices of the most powerful words, he want to find what the actually word is. Can you help him?
输入解释
The input consists of several test cases. Each case contain exactly two line, first line contains the magic words, words are seperated by spaces, the length of each word is at least 1 and at most 5, and the word contain only lowercase characters, the second line contains the indices, indices are seperated by spaces each index in the range [1, 232-1]. (Each line contains at most 10 words or numbers) Your job is to find the powerful word according the indices. The input end with a ling contain "-1".
输出解释
For each case, please print the powerful words in a single line seperated by one space without trailing space, according to the order in the input.
输入样例
hello magic
1 2 3
hello magic
4294967295
hello magic
67 141
-1
输出样例
hello magic ahello
yskwojhello
magico ahellou
来自杭电HDUOJ的附加信息
Recommend lcy

该题目是Virtual Judge题目,来自 杭电HDUOJ

源链接: HDU-1734

最后修改于 2020-10-25T22:47:38+00:00 由爬虫自动更新

共提交 0

通过率 --%
时间上限 内存上限
1000/1000MS(Java/Others) 32768/32768K(Java/Others)