기출 문제 / 삼성 2017 Second Half Afternoon Problem 2

Placing Operators

Given n integers in sequence, you are to place n−1 operators between the integers. The order of the given integers cannot be changed, and the operators can be addition, subtraction, or multiplication. Ignoring the precedence of operators and performing operations sequentially from left to right, write code to output the minimum and maximum possible values of the expression.