#P1981. [NOIP 2013 普及组] 表达式求值

    ID: 2734 远端评测题 1000ms 125MiB 尝试: 1 已通过: 1 显示难度普及− 上传者: 标签>模拟字符串2013NOIP 普及组

[NOIP 2013 普及组] 表达式求值

Background

NOIP 2013 Junior T2.

Problem 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 00 to 23112^{31}-1.

The input guarantees that this line contains only these 1212 characters: 0123456789+*.

Output Format

Output a single integer: the value of the expression.

Note: If the answer has more than 44 digits, output only the last 44 digits, and do not output leading 00s.

1+1*3+4

8
1+1234567890*1
7891
1+1000000003*1
4

Hint

For 30%30\% of the testdata, the total number of addition and multiplication operators in the expression is between 00 and 100100 inclusive.

For 80%80\% of the testdata, the total number of addition and multiplication operators in the expression is between 00 and 10001000 inclusive.

For 100%100\% of the testdata, the total number of addition and multiplication operators in the expression is between 00 and 100000100000 inclusive.

Translated by ChatGPT 5