题目描述
Evaluate the value of an arithmetic expression in Reverse Polish Notation.
Valid operators are +, -, *, /. Each operand may be an integer or another expression.
Some examples:
["2", "1", "+", "3", "*"] -> ((2 + 1) * 3) -> 9 ...
Evaluate the value of an arithmetic expression in Reverse Polish Notation.
Valid operators are +, -, *, /. Each operand may be an integer or another expression.
Some examples:
["2", "1", "+", "3", "*"] -> ((2 + 1) * 3) -> 9 ...
编写程序,从标准输入得到一个缺少左括号的表达式并打印出补全括号之后的中序表达式。
例如给定表达式: 1 + 2 )* 3 - 4 )* 5 - 6 ) ) )
程序可以输出:((1 + 2 )*((3 - 4)*(5 - 6)))
并计算结果,Java代码如下:
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;
import java.util.Stack;
/**
* 表达式求值
*
* @author 在线疯狂
*/
public class ExpressionUtils ...