1799.
Hacking the Screen
时间限制 1000 ms
内存限制 128 MB
The ZOO management had been wondering for a long time how to increase the number of
children visitors to the ZOO. The solution was surprising and unexpected in many ways. They
installed a huge screen past the entrance and started to display short quizzes on it. The child
in the crowd who first shouts out the answer to the quiz question is granted one day free access
to the ZOO. The screen became soon very popular and various types of quizzes are routinely
shown there. One type of the quiz is the math quiz containing arithmetic operations on integers.
The management worries that older siblings and friends of the children might develop a math
quiz screen hacking strategy: Snap the screen with the phone, run the image recognition SW
which extracts formulas from the image, evaluates them, and presents the solution to the phone
holder who immediately shouts out the answer.
Your task is to assess the difficulty of producing the screen hacking software. To get a better
feel of the problem you will first develop a simple toy model application. Your code will read
the formula presented in the preprocessed form of ASCII art and evaluate it.
输入数据
输出数据
For each test case print a separate line with the value V of the input formula.
样例输入
复制
1 13
1 + 2 * 3 - 4
2 16
_________
\/3 * 4 - 3 + 10
3 5
6 * 4
=====
12
3 13
22 __
3 - == - \/16
11
0 0
· \n
· · · · · · \n
\n
· \n
·· \n
· · · · · · \n
\n
· \n
· · \n
\n
·· \n
\n
· \n
····· ···· \n
· · · · \n
····· \n
\n
· \n