#P7052. [NWRRC2015] Easy Arithmetic

[NWRRC2015] Easy Arithmetic

题目描述

Eva is a third-grade elementary school student. She has just learned how to perform addition and subtraction of arbitrary-precision integers. Her homework is to evaluate some expressions. It is boring, so she decided to add a little trick to the homework. Eva wants to add some plus and minus signs to the expression to make its value as large as possible.

输入格式

The single line of the input file contains the original arithmetic expression. It contains only digits, plus (+)(‘+') and minus ()(‘-') signs.

The original expression is correct, that is:

numbers have no leading zeroes;

there are no two consecutive signs;

the last character of the expression is a digit.

The length of the original expression does not exceed 10001000 characters.

输出格式

Output a single line -- the original expression with some plus and minus signs added. Output expression must satisfy the same correctness constraints as the original one. Its value must be as large as possible.

题目大意

题目翻译

现向一个仅含有加减号和数字的表达式中添加一些加号或减号, 使得操作后的合法表达式的值最大, 并输出操作后的表达式。

当一个表达式合法时满足以下条件:

1.每一个数字不含前导零

2.表达式里没有两个连续的符号

3.表达式的最后一个字符是数字。

保证原始表达式是合法的, 且长度不大于 10001000

10+20-30

10+20-3+0

-3-4-1

-3-4-1

+10

+10

提示

Time limit: 2 s, Memory limit: 256 MB.