#t434. 波兰表达式
波兰表达式
Polish Notation
Problem Description
Polish notation puts the operator in front of its operands. For example, the ordinary expression 2 + 3 is written as + 2 3. Its advantage is that operators need no precedence rules and parentheses are unnecessary to change the order of evaluation; e.g. (2 + 3) * 4 becomes * + 2 3 4.
This problem asks you to evaluate a Polish expression. The operators are + - * / ^, where ^ is exponentiation.
Input Format
One line; operators and operands are separated by spaces. The operands are floating-point numbers; the total length is at most 250. The input contains no negative numbers.
Output Format
One line: the value of the expression.
You may print the value directly with printf("%f\n", v).
Sample Input
* + 11.0 12.0 + 24.0 35.0
Sample Output
1357.000000
Limitation
1 s, 1024 KiB for each test case.