11565 - Simple Equations


Difficulty : easy

Solution Description :

Ad hoc Iteration problem

Keep your mind
1. x,y, and z are distinct. i.e. x is not equal y, x is not equal z, y is not equal z.
2. x*y*z = B, so x,y, and z are divisor of B.
3. If you can calculate x, and y then z = a - (x+y).
4. x,y, and z can be negative.
5. x,y, and z are between -100 and 100, because C = x^2 + y^2 + z^2 here C<=10000

Now you can easily find x and y using two inner loop, and z = a - (x+y).