#P791. Expression ( 表達式 )
Expression ( 表達式 )
題目描述
Petya studies in a school and he adores Maths. His class has been studying arithmetic expressions. On the last class the teacher wrote three positive integers a, b, c on the blackboard. The task was to insert signs of operations '+' and '*', and probably brackets between the numbers so that the value of the resulting expression is as large as possible. Let's consider an example: assume that the teacher wrote numbers 1, 2 and 3 on the blackboard. Here are some ways of placing signs and brackets:
- 1+2*3=7
- 1*(2+3)=5
- 1*2*3=6
- (1+2)*3=9
Note that you can insert operation signs only between a and b, and between b and c, that is, you cannot swap integers. For instance, in the given sample you cannot get expression (1+3)*2.
It's easy to see that the maximum value that you can obtain is 9.
Your task is: given a, b and c print the maximum value that you can get.
Petya在一所學校學習,他喜歡數學。 他的班級一直在學習算術表達式。 最後一節課,老師在黑板上寫了三個正整數a、b、c。 任務是插入操作符號“+”和“*”,並可能在數字之間插入括號,以便結果表達式的值盡可能大。 舉個例子:假設老師在黑板上寫了數字 1、2 和 3。 以下是一些放置標誌和括號的方法:
1+2*3=7
1*(2+3)=5
1*2*3=6
(1+2)*3=9
請注意,您只能在 a 和 b 之間以及 b 和 c 之間插入運算符號,也就是說,您不能交換整數。 例如,在給定的示例中,您無法獲得表達式 (1+3)*2。
很容易看出,你可以獲得的最大值是 9。
你的任務是:給定 a、b 和 c 打印你能得到的最大值。
輸入格式
The input contains three integers a, b and c, each on a single line (1 ≤ a, b, c ≤ 10).
輸入包含三個整數 a、b 和 c,每個都在一行 (1 ≤ a, b, c ≤ 10)。
輸出格式
Print the maximum value of the expression that you can obtain.
打印您可以獲得的表達式的最大值。
Samples
["1\r\n2\r\n3\r\n","2\r\n10\r\n3\r\n"]
["9","60"]
原始資料
- Zero1 題號:
a791 - Hydro 題號:
Z0791 - Locale:
zh_TW - Display:
open