编程介的小学生 2017-09-21 05:12 采纳率: 20.5%
浏览 747
已采纳

Instruens Fabulam

Instruens Fabulam means drawing a chart (or table) in Latin. That's what you will do for this problem.

Input

The input consists of one or more table descriptions, followed by a line whose first character is '*', which signals the end of the file. Each description begins with a header line containing one or more characters that define the number and alignment of columns in the table. Each character in the header line is either '<', '=', or '>', and indicates a left-justified, centered, or right-justified column. Following the header are at least two and at most 21 data lines that contain the entries for each row. Each data line consists of one or more nonempty entries separated by an ampersand ('&'), where the number of entries is equal to the number of columns defined in the header line. The first data line contains entries for the column titles, and the remaining data lines contain entries for the body of the table. Spaces may appear within an entry, but never at the beginning or end of an entry. The characters '<', '=', '>', '&', and '*' will not appear in the input except where indicated above.

Output

For each table description, output the table using the exact format shown in the examples. Note that

The total width of the table will never exceed 79 characters (not counting end-of-line).
Dashes ('-') are used to draw horizontal lines, not underscores ('_'). 'At' signs ('@') appear at each of the four outer corners. Plus signs ('+') appear at intersections within the line separating the title from the body.
The largest entry in a column is always separated from the enclosing bars ('|') by exactly one space.
If a centered entry cannot be exactly centered within a column, the extra space goes on the right of the entry.

Input and correct output files satisfy all the requirements listed in Notes to Teams, except that the output may contain two or more consecutive spaces. There are no spaces at the beginning or end of lines, and only spaces are used (never tabs).

Sample Input

<>=>
TITLE&VERSION&OPERATING SYSTEM&PRICE
Slug Farm&2.0&FreeBSD&49.99
Figs of Doom&1.7&Linux&9.98
Smiley Goes to Happy Town&11.0&Windows&129.25
Wheelbarrow Motocross&1.0&BeOS&34.97

What is the answer?
42
<>
Tweedledum&Tweedledee
"Knock, knock."&"Who's there?"
"Boo."&"Boo who?"
"Don't cry, it's only me."&(groan)
*

Sample Output

@-----------------------------------------------------------------@
| TITLE | VERSION | OPERATING SYSTEM | PRICE |
|---------------------------+---------+------------------+--------|
| Slug Farm | 2.0 | FreeBSD | 49.99 |
| Figs of Doom | 1.7 | Linux | 9.98 |
| Smiley Goes to Happy Town | 11.0 | Windows | 129.25 |
| Wheelbarrow Motocross | 1.0 | BeOS | 34.97 |
@-----------------------------------------------------------------@
@---------------------@
| What is the answer? |
|---------------------|
| 42 |
@---------------------@
@---------------------------------------------@
| Tweedledum | Tweedledee |
|----------------------------+----------------|
| "Knock, knock." | "Who's there?" |
| "Boo." | "Boo who?" |
| "Don't cry, it's only me." | (groan) |
@---------------------------------------------@

  • 写回答

1条回答 默认 最新

  • threenewbee 2017-10-07 02:59
    关注
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 如何在scanpy上做差异基因和通路富集?
  • ¥20 关于#硬件工程#的问题,请各位专家解答!
  • ¥15 关于#matlab#的问题:期望的系统闭环传递函数为G(s)=wn^2/s^2+2¢wn+wn^2阻尼系数¢=0.707,使系统具有较小的超调量
  • ¥15 FLUENT如何实现在堆积颗粒的上表面加载高斯热源
  • ¥30 截图中的mathematics程序转换成matlab
  • ¥15 动力学代码报错,维度不匹配
  • ¥15 Power query添加列问题
  • ¥50 Kubernetes&Fission&Eleasticsearch
  • ¥15 報錯:Person is not mapped,如何解決?
  • ¥15 c++头文件不能识别CDialog