#P4882. Expression
Expression
Expression
题面翻译
题目描述
Petya在一所学校里学习数学。他们班最近在学算数表达式。最后一节课,老师在黑板上写了三个正整数a,b,c。他们的任务是在他们之间插入运算符号"+"和"* "来使得运算结果最大(可能会添加括号)。但是不能改变数字的顺序。
现在给你三个数,你要输出最大的可能。
输入输出格式
输入格式
三个正整数a,b,c,一个一行。(1<=a,b,c<=10)
输出格式
输出能得到的最大的数。
说明
从给的四个式子来看最大的可能是9。 不可以写成(1+3)* 2。
题目描述
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 , , 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 and , and between and , 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 , and print the maximum value that you can get.
输入格式
The input contains three integers , and , each on a single line ( ).
输出格式
Print the maximum value of the expression that you can obtain.
样例 #1
样例输入 #1
1
2
3
样例输出 #1
9
样例 #2
样例输入 #2
2
10
3
样例输出 #2
60