HTML Translation HTML语言解析
提供的Google翻译未必正确。还需自己理解。
Intoduction 引入
If you ever tried to read a html document on a Macintosh, you know how hard it is if no Netscape is installed.
Now, who can forget to install a web browser? This is very easy because most of the times you don't need one on a MAC because there is a Acrobate Reader which is native to MAC. But if you ever need one, what do you do?
如果您曾尝试在Macintosh上阅读html文档,那么您知道如果没有安装Netscape,那么它是多么的困难。
现在,谁可以忘记安装网络浏览器? 这是非常容易的,因为大多数时候,您不需要在MAC上,因为有一个Acrobate Reader是本机MAC。 但如果你需要一个,你做什么?
Description 描述
Your task is to write a small html-browser. It should only display the content of the input-file and knows only the html commands (tags)<br>which is a linebreak and<hr>which is a horizontal ruler. Then you should treat all tabulators, spaces and newlines as one space and display the resulting text with no more than 80 characters on a line.
你的任务是写一个小的html浏览器。 它应该只显示输入文件的内容,只知道html命令(标签)<br>它是一个换行符,而<hr>是一个水平标尺。 然后,您应该将所有制表符,空格和换行符视为一个空格,并在一行上显示不超过80个字符的结果文本。
I/O Formats 交互格式
Input 输入
The input consists of a text you should display. This text consists of words and HTML tags separated by one or more spaces, tabulators or newlines.
A word is a sequence of letters, numbers and punctuation. For example, "abc,123" is one word, but "abc, 123" are two words, namely "abc," and "123". A word is always shorter than 81 characters and does not contain any '<' or '>'. All HTML tags are either <br> or <hr>(No space between).
Every test data is promised that can be displayed in Chrome.
输入由您应显示的文本组成。 该文本由一个或多个空格,制表符或换行符分隔的单词和HTML标签组成。
一个字是一系列字母,数字和标点符号。 例如,“abc,123”是一个单词,但是“abc”123是两个单词,即“abc”和“123”。 一个字总是短于81个字符,不包含任何'<'或'>'。 所有HTML标签都是<br>或<hr>(之间没有空格)。
允许每个测试数据都可以在Chrome中显示。
Output 输出
You should display the the resulting text using this rules:
•If you read a word in the input and the resulting line does not get longer than 80 chars, print it, else print it on a new line.
•If you read a <br>in the input, start a new line.
•If you read a<hr>in the input, start a new line unless you already are at the beginning of a line, display 80 characters of '-' and start a new line (again).
The last line is ended by a newline character.
您应该使用此规则显示生成的文本:
•如果您在输入中读取一个单词,并且生成的行不会超过80个字符,请打印,否则将其打印在新行上。
•如果您在输入中读取了<br>,请启动新行。
•如果您在输入中读取<hr>,请开始新行,除非您已经在行的开头,显示80个字符的' - '并再次启动新行。
最后一行以换行符结尾。
The Only Sample 唯一的样例
Input 输入
Hi, my name...
... <br> is Sylvie, still a child.
<hr> I was very lucky to have a master that truly loves me, <br> and I am very glad to have him as my husband. Since
<hr> My first night has given to him <hr>
He is a good doctor, who truly <br> cares about me, and don't treat <br>
me that bad, and he also don't want scream from me. <hr>
Tea
chi
ng.
<hr> <hr> <hr>
Output 输出
Hi, my name... ...
is Sylvie, still a child.
--------------------------------------------------------------------------------
I was very lucky to have a master that truly loves me,
and I am very glad to have him as my husband. Since
--------------------------------------------------------------------------------
My first night has given to him
--------------------------------------------------------------------------------
He is a good doctor, who truly
cares about me, and don't treat
me that bad, and he also don't want scream from me.
--------------------------------------------------------------------------------
Tea chi ng.
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
Limitation 限制
2s, 2048MiB for each test case.
Hint 提示
The quickest way is to print online.
Source 来源
http://astrnuts.xyz/problem.php?id=1311
(AstrNuts OJ) Problem 1311 Written by AstrNuts:Sylvie
信息
- 难度
- 9
- 分类
- (无)
- 标签
- (无)
- 递交数
- 5
- 已通过
- 1
- 通过率
- 20%
- 上传者