Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Siamo spiacenti che qualcosa sia andato storto. Cosa è successo?

book
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:

a = 1, b = 2, c = 3

Output:

9
main.c

main.c

c

Chieda ad AI

expand

Chieda ad AI

ChatGPT

Chieda pure quello che desidera o provi una delle domande suggerite per iniziare la nostra conversazione

some-alt