描述Reverse Polish notation (or just RPN) by analogy with the related Polish notation, a prefix notation introduced in 1920 by the Polish mathematician Jan Łukasiewicz, is a mathematical notation wherein every operator follows all of its operands. It is also known as Postfix notation.
In Reverse Polish notation the operators follow their operands; for instance, to add three and four one would write "3 4 +" rather than "3 + 4". If there are multiple operations, the operator is given immediately after its second operand; so the expression written "3 − 4 + 5" in conventional infix notation would be written "3 4 − 5 +" in RPN: first subtract 4 from 3, then add 5 to that. An advantage of RPN is that it obviates the need for parentheses that are required by infix. While "3 − 4 * 5" can also be written "3 − (4 * 5)", that means something quite different from "(3 − 4) * 5", and only the parentheses disambiguate the
http://noi.openjudge.cn/ch0303/3340/
最新推荐文章于 2024-05-19 21:03:32 发布
这个任务要求设计一个简单的反向波兰记法(RPN)计算器,支持基本运算符如+,-,*,/(除数绝对值不小于10^-9)和^(幂运算)。计算器具有内存功能,每次计算会更新最小值。输入包含内存大小、初始值和RPN表达式,输出是每个表达式的计算结果。
摘要由CSDN通过智能技术生成