Root Solver
View as PDFWrite a program that solves for the root of a univariate polynomial with a maximum degree of .
Input Specification
Line  of the input contains an integer 
 
, indicating the number of terms in the polynomial.
The next  lines each contain a real number coefficient and a whole number exponent from 
 to 
 inclusive.
Terms will always be collected (i.e. exponents will not be repeated) and arranged in descending powers.
Output Specification
In order from lowest value to highest value, every real solution for when the polynomial is equal to zero.
Your answer must be accurate within  in absolute and relative error.
If there are no real solutions to the equation, output NO REAL ROOTS.
Note: Coefficients and answers can have up to  digits, and will fit inside a 
long double.
Sample Input 1
2
2 3
-54 0
Sample Output 1
3
Explanation for Sample Output 1
This asks for the solution(s) of  for the equation 
.
Sample Input 2
3
3 2
4 1
-20 0
Sample Output 2
-3.33333
2
Explanation for Sample Output 2
This asks for the solution(s) of  for the equation 
.
Comments
so real its complex