#T183. 逆波兰表达式
逆波兰表达式
Description
Reverse Polish Notation (RPN) is a mathematical notation in which operators precede their operands. For example, the conventional expression 2 + 3 is written as + 2 3 in RPN. The advantage of RPN is that operators do not need precedence rules or parentheses to dictate the order of operations. For instance, the expression (2 + 3) * 4 is written as * + 2 3 4 in RPN.
This problem involves evaluating an RPN expression where the operators include +, -, *, and /.
Input Format
The input consists of a single line where operators and operands are separated by spaces. Operands are floating-point numbers.
Output Format
The output is a single line containing the evaluated result of the expression. You may directly use printf("%f\n", v) to output the value v of the expression.
\* + 11.0 12.0 + 24.0 35.0
1357.000000