-
Describe
-
Use the formula X1 = (-B + sqrt (b*b-4*a*c))/(2*a), x2 = (-b-sqrt (b*b-4*a*c))/(2*a) to find a unary two-time equation ax2+ bx + c =0 Root, where a is not equal to 0.
-
Input
-
Enter a row containing three floating-point numbers A, B, C (they are separated by a space), representing the coefficients of the equation ax2 + bx + C =0, respectively.
-
Output
-
Outputs a line that represents the solution of the equation.
If two real roots are equal, the output form is: x1=x2= ....
If two real roots range, then the output form is: x1= ...; x2 = ..., where x1<x2.
If two virtual root, then output: x1= real part + imaginary Part I; x2= Real-imaginary Part I, where x1,x2 satisfies one of the following two conditions:
1. The real part of X1 is greater than the real part of X2
2. The real part of the X1 is equal to the real part of the X2 and the imaginary part of the X1 is greater than or equal to X2.
All real numbers are required to be accurate to 5 digits after the decimal point, with no spaces between the numbers and symbols.
-
Sample input
-
1.0 2.0 8.0
-
Sample output
-
x1=-1.00000+2.64575i;x2=-1.00000-2.64575i
-
Source
-
1709
1-4-20: Finding the root of a unary two-second equation