Please subscribe to the official Codeforces channel in Telegram via the link https://t.me/codeforces_official. ×

nerd's blog

By nerd, 13 years ago, translation, In English
Equation of a line in two dimensional plane is ax + by + c = 0

How to find coefficients {a, b, c}?

We can find them by simplifying and modifying this:


after:

(x - x1)(y2 - y1) = (y - y1)(x2 - x1)

x(y2 - y1) - x1(y2 - y1) = y(x2 - x1) - y1(x2 - x1)

(y2 - y1) * x + (x1 - x2) * y + y1(x2 - x1) + x1(y2 - y1) = 0

a = y2 - y1
b = x1 - x2
c =  - by1 - ax1

It is all...
  • Vote: I like it
  • 0
  • Vote: I do not like it

13 years ago, # |
  Vote: I like it 0 Vote: I do not like it
Good solution!!!