/ Vijos / 题库 /

# 描述

（双目的）`+``-`优先级相同，且为左结合。

`*``/`优先级相同，且为左结合。

`*``/`的优先级高于（双目的）`+``-`

`+``-`可能是单目运算符，这种情况下他们优先级高于`*``/`，并且右结合。

`+``-``*``/`分别为加法、减法、乘法、除法。

# 格式

## 输出格式

• 如果表达式非法，输出`FormulaException`
• 如果表达式合法但出现除法时除数为零（==0.0），输出`ZeroException`
• 如果表达式合法且计算正常，输出表达式的计算结果，结果四舍五入到小数点后第二位。

# 样例1

## 样例输入1

``````1+1
``````

## 样例输出1

``````2.00
``````

# 样例2

## 样例输入2

``````0123
``````

## 样例输出2

``````FormulaException
``````

# 样例3

## 样例输入3

``````2/(0.2-0.1-0.05-0.05)
``````

## 样例输出3

``````ZeroException
``````

# 样例4

## 样例输入4

``````((1+2)*3+4)*5
``````

## 样例输出4

``````65.00
``````

# 样例5

## 样例输入5

``````-(1)
``````

## 样例输出5

``````-1.00
``````

# 样例6

## 样例输入6

``````1-(-(-1))
``````

## 样例输出6

``````0.00
``````

# 样例7

## 样例输入7

``````2*-3
``````

## 样例输出7

``````FormulaException
``````

# 样例8

## 样例输入8

``````2--3
``````

## 样例输出8

``````FormulaException
``````

# 样例9

## 样例输入9

``````(2/(0.2-0.1-0.05-0.05)
``````

## 样例输出9

``````FormulaException
``````

ID
2019

8

(无)

491

40

8%

2

RP++分类题库