#P1981. [NOIP 2013 普及组] 表达式求值
[NOIP 2013 普及组] 表达式求值
Description
Given an arithmetic expression that contains only addition and multiplication, compute the value of the expression.
Input Format
One line: the expression to evaluate. The expression contains only digits, the addition operator +, and the multiplication operator *, with no parentheses. Every number that appears is an integer from to .
The input guarantees that this line contains only these characters: 0123456789+*.
Output Format
Output a single integer: the value of the expression.
Note: If the answer has more than digits, output only the last digits, and do not output leading s.
1+1*3+4
8
1+1234567890*1
7891
1+1000000003*1
4
Hint
For of the testdata, the total number of addition and multiplication operators in the expression is between and inclusive.
For of the testdata, the total number of addition and multiplication operators in the expression is between and inclusive.
For of the testdata, the total number of addition and multiplication operators in the expression is between and inclusive.
Translated by ChatGPT 5
京公网安备 11011102002149号