Код C++
Код: Выделить всё
#include "stdafx.h"
#include "stdio.h"
#include "iostream"
#include "algorithm"
using namespace std;
void main()
{
int a, b, c, d;
cin >> a >> b >> c;
d = b * b - 4 * a * c;
if (d == 0) {
cout << 1 << endl;
cout << -b / (2 * a);
}
if (d > 0) {
double x1 = (-b + sqrt(d)) / (2.0 * a);
double x2 = (-b - sqrt(d)) / (2.0 * a);
cout << 2 << endl;
cout << min(x1, x2) << ' ' << max(x1, x2);
}
else
cout << 0;
}