Reverse Polish Notation
Details
RPN (Reverse Polish notation) is a way of writing expressions such that
operators are written after their operands: 3 2 +
rather than
(3+2)
.
Each argument is an RPN expression, given as a space-separated list of
tokens: either a number 0
…32767
or an operator
(addition +
, subtraction -
, multiplication
*
or integer division /
).
Evaluate and print the result of each expression on its own line.
The result of each operation is a non-negative integer not exceeding 32,767. Division is guaranteed to have an exact integer result.
0 bytes, 0 chars
Restore solution
Compiled from
AT&T syntax to x86-64 Linux. Use
syscalls to write output.
ctrl + enter or