max volume

how to find max volume of the given box… ???
http://ww2.codechef.com/problems/J7

@hitesh091 >>

You can easily deduce:

4a + 4b + 4c = P 
2ab + 2ac + 2bc = S

Now you have to maximize V = abc, the volume of the box.

You can approach this using either Calculus or Lagrange multiplier to find the local optimum.

Or, if you recall some algebraic relations

      (a+b+c)**2 = a**2 + b**2 + c**2 - (2a*b + 2b*c + 2a*c)
=>    (a+b+c)**2 = (P/4)**2 = a**2 + b**2 + c**2 - S       ...(3)

Recall from your 3D classes, ax + by + cz + d = 0 is equation of a plane.
And x2 + y2 + z2 = r2 is the equation of a sphere with centre at origin and radius r, so from equation (3) you can observe that the solution is at the intersection of a plane and a sphere.

Proceed now, or ask if you still get any problem.

Maybe, @anton_lunyov can help you with some smarter tricks.

i have this idea:

V = abc = volume

let P/4 = p
and S/2 = s

b+c =p-a

b^2 + c^2 + 2b*c = (p-a)^2

ab+bc+ca = s => a(p-a) + bc = s => bc = s - a(p-a)

b^2 + c^2 = (p-a)^2 - (s-a(p-a))*2

now square the second relation from @bugkiller equation

(ab)^2 + (ac)^2 + (bc)^2 + 2Vp = s^2

substituting b^2+c^2 and bc from above we have a polynomial in power 4 for a
and rest all are constants

then we can maximize for a

=> please rectify if not correct

@bugkiller here single star represent multiplication but what does double star represent??

exponent. a**2 means a^2