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

建议使用的浏览器:

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

1732:Phone numbers

Special Judge 特殊评判
题目描述
In the present world you frequently meet a lot of call numbers and they are going to be longer and longer. You need to member such a kind of numbers. One method how to do it in an easy way is to assign letters to digits as shown in the following picture:

1 ij 2 abc 3 def
4 gh 5 kl 6 mn
7 prs 8 tuv 9 wxy
0 oqz

This way every word or a group of words can be assigned a unique number, so you can remember words instead of call numbers. It is evident that it has its own charm if it is possible to find some simple relationship between the word and the person itself. So you can earn that the call number 941837296 of a chess playing friend of yours can be read as WHITEPAWN, and the call number 2855304 of your favourite teacher is read BULLDOG.

Write a program to find the shortest sequence of words (i.e. one having the smallest possible number of words) which corresponds to a given number and a given list of words. The correspondence is described by the picture above.
输入解释
The first line of input contains the call number, the transcription of which you have to find. The number consists of at most 100 digits. The second line contains the total number of the words in the dictionary (maximum is 50000). Each of the remaining lines contains one word, which consists of maximally 50 small letters of the English alphabet. The total size of the input doesn't exceed 300KB.
输出解释
The only line of output contains the shortest sequence of words which has been found by your program. The words are separated by single spaces. If there is no solution to the input data, the line contains text `No solution.'. If there are more solutions having the minimum number of words, you can choose any single one of them.
输入样例
7325189087
5
it
your
reality
real
our
输出样例
reality our

该题目是Virtual Judge题目,来自 北京大学POJ

题目来源 CEOI 1999

源链接: POJ-1732

最后修改于 2020-10-29T06:12:34+00:00 由爬虫自动更新

共提交 0

通过率 --%
时间上限 内存上限
1000 65536