The Quadratic Equation

View as PDF

Submit solution

Points: 3
Time limit: 2.0s
Memory limit: 64M

Author:
Problem type
Allowed languages
Java

The quadratic formula can be used to calculate the roots (values of x) for any equation of the format ax^2 + bx + c = 0.
The quadratic formula is as follows: \begin{array}{*{20}c} {x = \frac{{ - b \pm \sqrt {b^2 - 4ac} }}{{2a}}}\end{array}

Determine whether or not a quadratic equation has real roots, then determine if there are multiple. If there are multiple roots, find them.

Input

The first line is the value of a.
The second line is the value of b.
The third line is the value of c.
These values will be between -100 and 100. They will not be 0.

Output

If there are no real roots, print No real roots. If there is 1 real root, print One real root., otherwise print the roots rounded to 2 decimal places with each root on a new line with x_1 followed by x_2.

Do not print trailing zeroes.

Sample Input 1

1
5
23

Sample Output 1

No real roots.

Sample Input 2

95
101
15

Sample Output 2

-0.18
-0.88

Comments

There are no comments at the moment.