Expression

View as PDF

Submit solution

Points: 15 (partial)
Time limit: 1.0s
Memory limit: 16M

Problem type
Allowed languages
Assembly, Brain****, C, C++, COBOL, Forth, Fortran, Java, Lua, Prolog, Text, Turing
ACSL Practice 2009

Given an arithmetic expression, output its value.

The expression will be given without spaces, but it may contain the four operators (+, -, /, *) and brackets ().
The regular order of evaluation applies. Division here is regarded as integer division.
(There will be no strange or invalid expressions, like 5(2(2)))

Sample Input

5*(3+3)-2-2

Sample Output

26

Sample Input 2

5*3*4/-7

Sample Output 2

-8

Comments

There are no comments at the moment.