We are familiar with infix notation for representing expressions, where the operator is placed infix between the operands, as in 5 * 5
. Given an expression in postfix notation, such as 5 5 *
, evaluate the expression and print it to standard output, rounded to one decimal place.
Valid operands are *
(multiplication), /
(division), +
(addition), -
(subtraction), %
(mod), and ^
(exponentiation).
Input Specification
A valid postfix expression. The input will have no more than
Output Specification
The result of the evaluation. The answer will be considered correct if its absolute or relative error does not exceed
Sample Input 1
Copy
5 5 +
Sample Output 1
Copy
10.0
Sample Input 2
Copy
5 5 + 6 * 8 -
Sample Output 2
Copy
52.0
Comments
DMOJ should really show us the input they used so that way it's must faster and time-saving to change the code
Anyone know the input for Test Case #3? I'm failing that test case.
input
what is the type of numbers in input ??
Just use floating point