simple equation uva

http://uva.onlinejudge.org/external/115/11571.html
Can anyone help me with a solution to this problem just not able to get it
Thanks in advance :slight_smile:

(x+y+z)/xyz = (1/yz)+(1/xz)+(1/xy)
(x+y+z)^2 = x^2+y^2+z^2+2(xy+yz+xz)

i could get to that extent

thanks, but it didnt help me :frowning:

still not got to the solution…not anywhere near it :frowning:

still not got to the solution…not anywhere near it :frowning:

1 - http://apps.topcoder.com/forums/?module=Thread&threadID=651635&start=0&mc=5

2 - http://online-judge.uva.es/board/viewtopic.php?f=50&t=42548

glance links above, that is all i can do for now

hi,
plz leme know if it helps you.

x + y + z = A
xyz = B
x2 + y2 + z2 = C

z^3 - A(Z^2) + {(A^2 - C)/2}z - B = 0 …1 eq

find out using formula for 3 degree equation and will get 3 roots. lets say z1,z2,z3

now equation converted to 2 degree equation :

x + y + z1 = A ==> x + Y = A - z1 = P (say)
xyz1=B ==> xy = B/z1 = Q (say)
x^2 + y^2 + z1^2 = C ==> x^2 y^2 = c - z1^2 = R (say)

so equations are now:

x + Y = P
xy = Q
x^2 y^2 = R

y^2 -Py + Q = 0 …2 eq

values of y can be find out using standered 2 degree equation … let say y1,y2

@parashar13 thanks…but the logic and code of finding roots of a 3rd degree equation is a little hard to remember
the following link is for getting roots of cubic equation
http://soot.googlecode.com/svn/CalFuzzer2.0/src/benchmarks/detinfer/pj/edu/rit/numeric/Cubic.java

@garakchy thanks :slight_smile:

//