Maximize the Expression
Bill 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.
Possible variants:
- a+b*c=v1
- a*(b+c)=v2
- a*b*c=v3
- (a+b)*c=v4
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 (a+c)*b.
Given an integers a, b and c. Return maximum value of the expression that you can obtain.
Example 1
Input:
Output:
main.c
Spør AI
Spør AI
Spør om hva du vil, eller prøv ett av de foreslåtte spørsmålene for å starte chatten vår