~/algor $ cat problems/ikki-nuqtadan-togri-chiziq
Line through two points
Medium
1000 ms
64 MB
38%
Two points on the plane are given: $A(x_{1}; y_{1})$ and $B(x_{2}; y_{2})$. Find the coefficients $k$ and $b$ of the line $y = k * x + b$ passing through them:
$$k = \frac{y_{2} - y_{1}}{x_{2} - x_{1}}, \qquad b = y_{1} - k * x_{1}$$
Input
One line with four integers: $x_{1}$, $y_{1}$, $x_{2}$ and $y_{2}$.
Output
One line with two numbers: $k$ and $b$, each with exactly 2 digits after the decimal point (for example, 2.00). If the rounded result is zero (for example, $-0.001$), print 0.00 (not -0.00).
Note
$-1000 \le x_{1}, y_{1}, x_{2}, y_{2} \le 1000$
$x_{1} \ne x_{2}$
Examples
Input #1
1 3 3 7
Output #1
2.00 1.00
Input #2
-2 1 4 -2
Output #2
-0.50 0.00