Algorithm question.

Posted by Lukasz Lew on Stack Overflow See other posts from Stack Overflow or by Lukasz Lew
Published on 2010-04-25T14:50:27Z Indexed on 2010/04/25 15:03 UTC
Read the original article Hit count: 460

I can't solve it:

You are given 8 integers:

  • A, B, C representing a line on a plane with equation A*x + B*y = C
  • a, b, c representing another line
  • x, y representing a point on a plane

The two lines are not parallel therefore divide plane into 4 pieces. Point (x, y) lies inside of one these pieces.

Problem:
Write a fast algorithm that will find a point with integer coordinates in the same piece as (x,y) that is closest to the cross point of the two given lines.

Note:
This is not a homework, this is old Euler-type task that I have absolutely no idea how to approach.

© Stack Overflow or respective owner

Related posts about algorithm

Related posts about problem-solving