Skip to main content
Tuesday (24.11.2026) at 20:00: ALGOR Contest: Round #4 (Special Challenge) starts!

~/algor $ cat problems/begin-kvadrat-tenglama

Quadratic equation

Medium 1000 ms 64 MB 38%
Share

A quadratic equation $a * x^{2} + b * x + c = 0$ is given, where $a \gt 0$ and the discriminant is positive, so it has two distinct roots. Find them:

$$D = b^{2} - 4 * a * c, \qquad x_{1} = \frac{-b - \sqrt{D}}{2 * a}, \qquad x_{2} = \frac{-b + \sqrt{D}}{2 * a}$$

Since $a \gt 0$, $x_{1} \lt x_{2}$.

A parabola crosses the x axis at two points: x1 and x2 are the roots of the equation

Input

One line with three integers: $a$, $b$ and $c$.

Output

One line with two numbers: $x_{1}$ and $x_{2}$, each with exactly 3 digits after the decimal point (for example, 1.000).

Note

$1 \le a \le 1000$
$-1000 \le b, c \le 1000$
$b^{2} - 4 * a * c \gt 0$

Examples

Input #1
1 -3 2
Output #1
1.000 2.000
Input #2
1 0 -2
Output #2
-1.414 1.414

Sign in to submit a solution

Signing up is free and takes a minute.