2587. Principles of Compiler II

单点时限: 2.0 sec

内存限制: 256 MB

After learnt then Principles of Compiler,partychen thought that he can solve a simple expression problem.So he give you strings of less than 100 characters which strictly adhere to the following grammar (given in EBNF):

Expression := Term { (‘+’ | ‘-‘) Term }

Term := Factor { (‘*’|’/’) Factor }

Factor := Number | ‘(‘ Expression ‘)’

Number := Digit | Digit Number

Digit := ‘0’ | ‘1’ | … | ‘9’

Can you solve them too?

输入格式

The first line of gives a string as described above.

输出格式

output the expression’s result in a single line

样例

Input
((1+1-1)*123)+(2*3-10)/2+25
Output
146
Hint:
If you meet “/”,you only save the Integral part.For example,5/2,the result is 2.

17 人解决,28 人已尝试。

24 份提交通过,共有 109 份提交。

5.8 EMB 奖励。

创建: 16 年,11 月前.

修改: 7 年,2 月前.

最后提交: 8 月,3 周前.

来源: partychen

题目标签