Олимпиадный тренинг

Задача 27291. cubic equation


Задача

Темы:
Four real numbers are given: A, B, C, D. Find all the roots of the equation Ax3+Bx2+Cx+D=0. It is known that all roots of this equation do not exceed 1000 in absolute value. It is known that any two roots of this equation differ by at least 10-6.
 
Input
The program receives four real numbers as input: A, B, C, D. Any of these four numbers, but not all at the same time, can be equal to 0.
 
Output
The program should print from 0 to 3 real numbers: the roots of the given equation in ascending order. Multiple roots need only be drawn once. Root values ​​must be displayed with an accuracy of 6 characters after the dot.
 
Input Output
0 0 1000 -1 0.001