POLYEQ - Polynomial Equations
You are given the polynomial F(x) as the sum of monomials.
Each monomial has the form:
[coefficient*]x[^degree] or [coefficient],
where coefficient and degree are integers such that -30000 <= coefficient <= 30000, 0 <= degree <= 6. The parameters given in [] can be skipped.
In this problem you have to find all solutions of the equation: F(x)=0.
Input
t – the number of test cases, then t test cases follow. [t <= 100]
Each line contains one polynomial F(x) given as string s in the form described above.
The length of string s is not more than 300 characters.
Output
For each test case output all solutions (including repeated) of the given equation in non-decreasing order. All solutions lie within the interval [-100.0; 100.0]. Each solution must be given with an error of not more than 0.01. It's guaranteed that all solutions are real, not complex.
Example
Input: 2 x^4-6*x^3+11*x^2-6*x -x^2+2*x-1 Output: 0.00 1.00 2.00 3.00 1.00 1.00
Added by: | Roman Sol |
Date: | 2005-01-27 |
Time limit: | 1.694s |
Source limit: | 50000B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Languages: | All except: ERL JS-RHINO |
Resource: | ZCon 2005 |