• Source
    1. #include <iostream>
    2. #include <math.h>
    3. #include <stdio.h>
    4. using namespace std;
    5.  
    6. int main ()
    7. {
    8. long long A, B, C;
    9. cin>>A>>B>>C;
    10. if (A==0)
    11. {
    12. if (B==0 && C!=0) printf ("0");
    13. else if (B==0 && C==0) printf ("-1");
    14. else
    15. {
    16. printf ("1\n");
    17. printf ("%.5lf", -1.0*(double)C/(double)B);
    18. }
    19. }
    20. else
    21. {
    22. long long denta = B*B - 4*A*C;
    23. if (denta<0) printf ("0");
    24. else if (denta==0)
    25. {
    26. printf ("1\n");
    27. printf ("%.5lf", -1.0*(double)B/(2.0*(double)A));
    28. }
    29. else
    30. {
    31. printf ("2\n");
    32. double x = (-1.0*(double)B-sqrt(denta))/(2.0*(double)A);
    33. double y = (-1.0*(double)B+sqrt(denta))/(2.0*(double)A);
    34. if (x>y) printf ("%.5lf\n%.5lf",y,x);
    35. else printf ("%.5lf\n%.5lf",x,y);
    36. }
    37. }
    38. return 0;
    39. }