問題一覧 > 通常問題

No.49 Arithmetic Homework

レベル : / 実行時間制限 : 1ケース 5.000秒 / メモリ制限 : 512 MB / 標準ジャッジ問題
タグ : (AC するまで非表示) / 解いたユーザー数 334
作問者 : なお
お気に入りにしたユーザー ProblemId : 87 / 自分の提出
問題文最終更新日: 2026-06-25 01:28:39
This statement was translated by AI (claude-opus-5-5, effort medium) and may contain errors or differ in nuance from the original. The original statement takes precedence. Back to the original
yukicoder contest 42 (順位表) の他の問題:

Problem Statement

Taro is very bad at arithmetic, and he is in trouble because he has been given arithmetic homework.
Today's homework consists of addition and multiplication problems, and it must be finished by tomorrow,
so please solve it in place of the troubled Taro.

In Taro's country, addition is represented by the symbol '*', and multiplication is represented by the symbol '+'.
Also, addition and multiplication have no precedence; calculations are performed in order from left to right.

Input

S

On line \(1\), a string \(S\) representing the expression is given, consisting of at most \(100\) characters.
The string consists only of the characters '0'~'9', '*', and '+'.
It contains no spaces, and a number with 2 or more digits never starts with 0.
Invalid expressions, such as one that starts with an operator or one with 2 consecutive operators, are never given.

Output

Output the value of the calculation result.
The value of the calculation result never exceeds \(10,000\).
Print a newline at the end.

Sample

Sample 1
Input
2*3
Output
5

In Taro's country, the symbol '*' represents addition. Adding \(2\) and \(3\) gives the answer \(5\).

Sample 2
Input
6*7+2
Output
26

In our world's notation this is \(6 + 7 \times 2\), but since there is no precedence, we add \(6\) and \(7\) and then multiply by \(2\).

Sample 3
Input
2497*3+4
Output
10000

提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。