11573 - 231001_10/2_practice3-2
|
Time |
Memory |
| Case 1 |
1 sec |
32 MB |
| Case 2 |
1 sec |
32 MB |
| Case 3 |
1 sec |
32 MB |
| Case 4 |
1 sec |
32 MB |
| Case 5 |
1 sec |
32 MB |
Description
Find all roots of a quadratic equation: ax2+bx+c=0, where the coefficients a, b, and c are float.
Use b2-4ac to judge the roots and calculate the roots r1 and r2.
Three cases of the roots:
-
Case1: Two distinct real roots
-
Case2: Two equal roots
-
Case3: Two distinct complex roots
Input
-
Three decimals ( float ) , represent three coefficients a, b, and c respectively.
-
Use space to separate each decimals.
Output
-
Print the judgement of the roots and the roots ( float ) round off to the four decimal place(四捨五入至小數點第四位).
-
Case1: print "Two distinct real roots: r1 and r2"
-
Case2: print "Two equal roots: r1 and r2"
-
Case3: print "Two distinct complex roots: r1 and r2"
-
There are spaces before and after “+” and “-”.
-
Put “\n” after the result.
-
Download the sample to check the format.
Tags