2022.1.28
题目网址:
https://acs.jxnu.edu.cn/problem/CF5B
原题:
Center Alignment
1000ms 65536K
描述:
Almost every text editor has a built-in function of center text alignment. The developers of the popular in Berland text editor ?Textpad? decided to introduce this functionality into the fourth release of the product.
You are to implement the alignment in the shortest possible time. Good luck!
输入:
The input file consists of one or more lines, each of the lines contains Latin letters, digits and/or spaces. The lines cannot start or end with a space. It is guaranteed that at least one of the lines has positive length. The length of each line and the total amount of the lines do not exceed 1000.
输出:
Format the given text, aligning it center. Frame the whole text with characters ?*? of the minimum size. If a line cannot be aligned perfectly (for example, the line has even length, while the width of the block is uneven), you should place such lines rounding down the distance to the left or to the right edge and bringing them closer left or right alternatively (you should start with bringing left). Study the sample tests carefully to understand the output format better.
样例输入:
This isCodeforces Beta Round 5
样例输出:
************ * This is * * * *Codeforces* * Beta * * Round * * 5 * ************
翻译:
描述:
几乎每个文本编辑器都有一个居中对齐功能。在贝兰流行的文本编辑器《Textpad》的开发者决定在第四版中引入该功能。
你必须在尽可能最短的时间内实现对齐。祝你好运!
输入:
输入文件包含一行或多行,每行包括拉丁字母数字和/或空格。每行不能以空格开始或者结束。确保至少有一行为正整数。每行的长度和总行数不超过1000。
输出:
格式化给定的文本,使其居中。用最少的字符 * 框定整个文本。如果一行不能完全对齐(例如,这一行是偶数的长度,然而块的宽度不是偶数),你应该把这些线四舍五入到左边或右边边缘的距离,并交替地使它们更靠近左边或右边(你应该从左边开始)。仔细研究样例去理解怎么更好的把输出格式化。