Share your approach ( Or a C++ solution ) for this problem.

I was given this problem in a College contest but could not solve it.

Can you all share your approach ?

You are given co-ordinates of 4 houses (A , B , C , D) in the form (x , y). You are also given two numbers d1 , d2. You need to build your house in this 2D grid such that the following two conditions are satisfied.

Distance of house A from your house = d1 * distance of house C from your house

Distance of house B from your house = d2 * distance of house D from your house

CONSTRAINTS

10^-5 <= X , Y <= 10^5

1 <= D1 , D2 <= 10^5

INPUT

X1 Y1

X2 Y2

X3 Y3

X4 Y4

D1 D2

OUTPUT

Co-ordinates of your house ( Accepted upto 2 decimal places )

I ended up with a quadratic equation but how to solve that ?

I don’t remember the sample test case

1 Like
//