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

建议使用的浏览器:

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

1462:Word Crosses

题目描述
A `word cross' is formed by printing a pair of words, the first horizontally and the second vertically, so that they share a common letter. A `leading word cross' is one where the common letter is as near as possible to the beginning of the horizontal word, and, for this letter, as close as possible to the beginning of the vertical word. Thus DEFER and PREFECT would cross on the first 'E' in each word, PREFECT and DEFER would cross on the 'R'. `Double leading word crosses' use two pairs of words arranged so that the two horizontal words are on the same line and each pair forms a leading word cross.

Write a program that will read in sets of four words and form them (if possible) into double leading word crosses.

输入解释
Input will consist of a series of lines, each line containing four words (two pairs). A word consists of 1 to 10 upper case letters, and will be separated from its neighbours by at least one space. The file will be terminated by a line consisting of a single #.
输出解释
Output will consist of a series of double leading word crosses as defined above. Leave exactly three spaces between the horizontal words. If it is not possible to form both crosses, write the message `Unable to make two crosses'. Leave 1 blank line between output sets.

输入样例
MATCHES CHEESECAKE PICNIC EXCUSES
PEANUT BANANA VACUUM  GREEDY
A  VANISHING   LETTER TRICK
#
输出样例
 C
 H
 E
 E
 S
 E          E
 C          X
MATCHES   PICNIC
 K          U
 E          S
            E
            S

Unable to make two crosses

V
A   LETTER
N     R
I     I
S     C
H     K
I
N
G
来自杭电HDUOJ的附加信息
Recommend lcy

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

源链接: HDU-1462

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

共提交 228

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