2003年ACM初赛南太平洋地区第二题
刚翻译过来的题目。
呵呵,我也没有写代码。
各位加油啊。
明天五一,先祝大家五一快乐。
我明天也打算除去转转,然后回来再写此题代码!
2003年ACM初赛,南太平洋地区第二题(第一题我已经贴出题目和代码)!
P2 - ACM SPPC 1 of 2 Saturday, 20/09/2003
PROBLEM 2 - CD TITLES
A keen photographer, I found my hard disk quickly filling up with snapshots and
videos. I decided to offload a lot of the files to CD. Each CD is in its own plastic
case, and the contents are clearly described on the front of the case. As the
number of CDs increased, I built myself a shelf on which the CDs stand vertically.
I need your help! I have written a title for each CD into a text file, but I need the
titles to appear vertically so that I can put them in the spine of the CD cases and
be able to read them easily from the shelf. I want you to write a program that will
output my titles vertically. I need lines between each title so that, when I print
them, I can easily cut along the lines.
I have worked out that I can fit 36 characters into the available space, so all
output titles must be 36 characters long, padded with spaces at the end where
necessary. If I accidentally make a title too long, only output the first 36
characters.
INPUT FORMAT
Input will be at most 50 titles, one to a line. Each title consists of 1 to 100 arbitrary
characters. A single ‘#’ on a line by itself indicates the end of input.
P2 - ACM SPPC 2 of 2 Saturday, 20/09/2003
OUTPUT FORMAT
Output will be the same titles presented vertically, where the left to right order will
be the same as the order of the input. There will be a column of bar (‘|’)
characters at each end, and separating each title, and a row of minus (‘-’)
characters (1 per column) at the beginning and end.
SAMPLE OUTPUT:
-------
|0|D|B|
|1|a|a|
|2|v|h|
|3|i|a|
|4|d|m|
|5| |a|
|6|a|s|
|7|n| |
|8|d|H|
|9| |o|
|0|J|l|
|1|a|i|
|2|n|d|
|3|e|a|
|4|'|y|
|5|s| |
|6| |A|
|7|w|u|
|8|e|g|
|9|d|u|
|0|d|s|
|1|i|t|
|2|n| |
|3|g|2|
|4|,|0|
|5| |0|
|6|M|1|
|7|a| |
|8|r| |
|9|c| |
|0|h| |
|1| | |
|2|2| |
|3|0| |
|4|0| |
|5|2| |
-------
我的翻译如下:
问题2 -- CD标签
我是一个热心的摄影师,可是我发现我的硬盘很快就被快照和视频填满,所以我打算把大部分文件转移到CD上。
每张CD都装在它自己的塑料盒中,在盒子的前面有一个很清晰的说明。随着CD数目的增加,我自己制
作了一个书架可以让CD都直立的摆放在一起。现在我需要你的帮助!我已经将每一张CD标签写入一
个文本文件中,可是我需要这些标签垂直的显示,以便我把它们插入CD盒的盒脊上,从而轻松的在书
架上浏览CD。我希望你写一个程序能够把我的标签垂直输出。我需要每个标签之间有一条线,当我
打印它们以后,我可以沿着这条线裁剪它们。
我已经计算出该竖直的空间内适合36个字符,因此所有标签的输出必须是36个字符的长度,必要的情况
下,末尾可以用空白填补。如果我意外的使标签长度超过36个字符,那么你可以只打印前36个字符。
输入格式
每次最多输入50个标签,每行一个标签。每个标签由1至100个随意的字符组成。一个单独的#号占用一行,标识输入结束。
SAMPLE INPUT:
012345678901234567890123456789012345
David and Jane’s wedding, March 2002, Alexandria
Bahamas Holiday August 2001
#
输出格式:
输出为标签的相应竖直表示,并遵循从左到右的顺序。每个标签之间都有一列'|'符号,以分割每个标签,
在在开始和结束的行会有一行'-'符号(存在于每个列的顶部)。
输出举例:
-------
|0|D|B|
|1|a|a|
|2|v|h|
|3|i|a|
|4|d|m|
|5| |a|
|6|a|s|
|7|n| |
|8|d|H|
|9| |o|
|0|J|l|
|1|a|i|
|2|n|d|
|3|e|a|
|4|'|y|
|5|s| |
|6| |A|
|7|w|u|
|8|e|g|
|9|d|u|
|0|d|s
我被捕了。
第一天敌人用富贵引诱我,我没招;
第二天敌人严刑拷打我,我也没招;
第三天敌人送了一个美女给我,我招了;
第四天我还想招,敌人把我杀了!!!
My HomePage:www.cstc.net.cn
My Blog :www.cnblogs.com/monkeyking
Call me at: 29743836