#P1575. 正误问题
正误问题
Description
Xiao bobo became obsessed with Boolean operations. But after calculating until he got dizzy, he still could not figure it out. He turned to you for help to solve this problem.
Input Format
A string representing a logical expression, containing only true, false, or, and, not, and spaces (no parentheses and no xor). Operator precedence follows Pascal (from high to low: not, and, or), and within the same level evaluate from left to right. If the logical expression is invalid, output error.
Output Format
Output one line with the result: true or false. If the result cannot be determined, output error.
true or false and false
true
Hint
For all testdata, the input string length is less than .
For this problem, the results true, false, and error each account for ; "cheating for points" is allowed, but it is not worth it because this is an "easy problem".
- : Added groups of Hack testdata.
Translated by ChatGPT 5
京公网安备 11011102002149号