#250. D++ Again
D++ Again
Background
D++语言仍处于改进阶段。创建者想使到它的语法尽可能地清晰,以便程序更简明。
Description
一个正确的D++程序包含符号部分,算术表达式,和注释。注释可以出现在任何地方,包含任何字符。注释的开头用"("表示,结束用 ")"表示。每一个注释必须有结束标志。一个算术表达式是用"(",")"括起,可以包含以下字符:"=+-*/0123456789)(" ,当然可以有注释在其中。 算术表达式中不允许有空格(???),可以有回车符。算术表达式中可以嵌套括号,但括号必须匹配。即诸如: "((1)))" , "(23))((+)" 等不是合法的。当且仅当括号匹配正确,表达式才是正确的。最后,其他字符文字可以是除"(" 和")"外的字符。
另外特别指出,空格在程序的任一地方出现是可能的,除了不能在算术表达式中出现外。
Format
Input
输入一些文本,长度不超过10000,可能是字母,括号,字符,算术运算符,以及 "end of line"符号 和"carriage return"回车符。
Output
假如文本符合D++规则,则输出YES,否则输出NO。
Samples
Hello, here is a sample D++ program. It contains some arithmetical expressions like(2+2=4), (2+-/*) and ((3+3)*3=20(*this is not true, but you don抰 have to verify it :-) *)+8)
(* the closing bracket in the previous comment is also in order, since this bracketdoes not belong to any arithmetical expression*)
YES
Limitation
1s, 1024KiB for each test case.
统计
相关
在以下作业中: