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

建议使用的浏览器:

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

3426:XML

题目描述
In this problem, you are asked to determine if a given document satisfies the syntax of an XML-like language.

A simple XML-like document can be parsed as a sequence of the following:

1. Plain text---ASCII codes between 32 and 127 (inclusive), with none of the following symbols: <, >, &
2. The sequences:
* &lt;
* &gt;
* &amp;
These encode a <, >, or & respectively.
3. &xHEX; HEX must be any even (positive) number of upper or lower case hexadecimal digits, and this represents the bytes given.
4. <tag> Tag can be any lowercase alphanumeric string. This tag is pushed onto the context stack.
5. <tag/> This tag is not pushed onto the context stack (there is no closing context).
6. </tag> This tag removes the <tag> context from the stack, which must be topmost on the stack.

By the time the entire document is parsed, the context stack is empty for a valid document. We should also note that the empty string is considered valid.
输入解释
You will be given a number of documents to process. Each document is given as one line oftext which may be empty. The input is terminated by the end of file.
输出解释
For each document given, print valid on a single line if it is a valid XML-like document,or invalid otherwise.
输入样例
the quick brown fox.
the quick brown fox.
fox & socks.
3x+5>7
Null: &x00;
the quick brown fox.
the quick brown fox
fox & socks.
3x+5>7
Null: &x0;
输出样例
valid
valid
valid
valid
valid
invalid
invalid
invalid
invalid
invalid
来自杭电HDUOJ的附加信息
Recommend zhouzeyong

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

源链接: HDU-3426

最后修改于 2020-10-25T23:03:24+00:00 由爬虫自动更新

共提交 0

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