#B2053. Finding Roots of a Quadratic Equation
Finding Roots of a Quadratic Equation
Finding Roots of a Quadratic Equation
Given a quadratic equation in the form ax2 + bx + c = 0 with a ≠ 0, you are required to compute its two roots using the formulas:
$$x_1=\frac{-b+\sqrt{b^2-4ac}}{2a}, \quad x_2=\frac{-b-\sqrt{b^2-4ac}}{2a}$$
The results must be output with precision up to 5 decimal places.
inputFormat
The input consists of three space-separated numbers: a, b, and c, representing the coefficients of the quadratic equation ax2 + bx + c = 0. It is guaranteed that a is not equal to 0.
outputFormat
Output two numbers: the values of x1 and x2 calculated using the formulas provided. Each value should be formatted to exactly 5 decimal places. The first number corresponds to x1 using the '+' formula, and the second corresponds to x2 using the '-' formula.
sample
1 -3 2
2.00000 1.00000