No.193 Expression on a Cylinder
タグ : / 解いたユーザー数 259
作問者 :
Problem Statement
A mathematical expression is written on the side of a cylinder so that its end connects to its beginning.
Cut the cylinder open at any one position between two characters of your choice to form an expression.
Here, the expression must not begin or end with an operator.
Leading zeros$(012,003$ and other notations of numbers starting with $0$$)$ are allowed.
Find the maximum value of the result of the expression obtained by cutting the cylinder open.
Notation with consecutive operators, such as 1+-1, is not given.
Input
$S$
$S$ is a string consisting only of digits$,$ or $+,-$
$3 \le |S| \le 10$
It contains at least $1$ operator.
The input is given such that at least $1$ valid expression can be formed.
Output
Output the maximum value.
Sample
Sample 1
Input
1+1
Output
2
The $3$ expressions $1+1,+11,11+$ can be formed, but since an expression must not begin or end with an operator, only $1+1$ is valid.
Sample 2
Input
1+111
Output
112
Sample 3
Input
10+4-1+15
Output
514
提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。