1.19英语翻译

题目来源:https://acs.jxnu.edu.cn/problem/POJ2106
重点单词:
operators:n.运算符
priority :n.优先事项
yield :n.屈服,v.产生
variable:adj.多变的
exceed :v.超过
separate:v.分隔
sequence:n.序列
resulting value:结果值
consecutive:adj.随后的
corresponding:adj.相应的
format: n.格式

Boolean Expressions
布尔表达式
 1000ms  30000K

描述:

The objective of the program you are going to produce is to evaluate boolean expressions as the one shown next:
Expression: ( V | V ) & F & ( F | V )
你将要生成的程序的目的是去评估布尔表达式,以下便是一个示例:  表达式:(V|V)&F&(F|V) where V is for True, and F is for False. The expressions may include the following operators: ! for not , & for and, | for or , the use of parenthesis for operations grouping is also allowed.
To perform the evaluation of an expression, it will be considered the priority of the operators, the not having the highest, and the or the lowest. The program must yield V or F , as the result for each expression in the input file. V表示正确,F表示错误。这表达式可能包含以下一些运算符:!代表非,&代表和,| 代表或,也允许使用括号去进行操作分组。 执行表达式的评估,需要考虑运算符的优先级,且没有最高或最低优先级。这个程序必须要产生V或F,作为输入文件中每一个表达式的结果。

输入:

The expressions are of a variable length, although will never exceed 100 symbols. Symbols may be separated by any number of spaces or no spaces at all, therefore, the total length of an expression, as a number of characters, is unknown.
The number of expressions in the input file is variable and will never be greater than 20. Each expression is presented in a new line, as shown below. 虽然这表达式的长度是可变的,但不会超过100个符号。符号可以由任意数量的空格或没有空格来隔开,因此,作为这表达式的总长度是未知的。 输入文件中的表达式数量是可变的并且不会多于20个。每个表达式都显示在一个新行上,如下所示

输出:

For each test expression, print "Expression " followed by its sequence number, ": ", and the resulting value of the corresponding test expression. Separate the output for consecutive test expressions with a new line. Use the same format as that shown in the sample output shown below.
对于每个测试表达式,打印“Expression”,后面跟着它的序列号,“:”,以及相应测试表达式的结果值。 用新行分隔连续测试表达式的输出 使用和下面显示的示例输出相同的格式。

样例输入:

( V | V ) & F & ( F| V)
!V | V & V & !F & (F | V ) & (!F | F | !V & V)
(F&F|V|!V&!F&!(F|F&V))

样例输出:

Expression 1: F
Expression 2: V
Expression 3: V
上一篇:LeetCode:前 K 个高频元素


下一篇:访问其伪造属性操作