P4908 Xiaoben Attends Class
Background
This class is a math class!
Description
Xiaoben likes math the most QvQ, but he was too sleepy at night and fell asleep. So when he finally realized he needed to work on problems, the expression on the blackboard was already badly damaged.
With no choice, Xiaoben has to rely on luck to guess. But there is a method to guessing: Xiaoben wants you to give the maximum possible value and the minimum possible value, and output only one line: the average of the maximum possible value and the minimum possible value, keeping two decimal places.
Input Format
Only one line: the incomplete expression (parentheses may appear). The missing parts are represented by $*$ ~~(same as the multiplication sign)~~. Each missing part can be a digit from $0$ to $9$, or one of the four arithmetic operators. There will be no missing parentheses.
Output Format
Output only one line: the average of the maximum possible value and the minimum possible value, keeping two decimal places.
Explanation/Hint
Sample explanation:
Maximum value: $191+9-2+3/1=201$.
Minimum value: $1-1+9-293/1=-284$.
Expressions like $07+1$ (a number cannot start with $0$), $5/0$ ($0$ cannot be a divisor), etc. are illegal.
But $8+-6$ is legal, meaning $8$ plus negative $6$. Similarly, $8/-6$ is also allowed.
It is guaranteed that the result is within the $float$ range.
For $40$% of the testdata, the expression contains parentheses.
For $10$% of the testdata, the expression is completely missing (all are $*$).
Translated by ChatGPT 5