题目链接
#include <iostream>
#include <algorithm>
#include <cmath>
using namespace std;
signed main(){
double a, b, c;
cin >> a >> b >> c;
double delta = b*b - 4*a*c;
if (delta < 0 || a == 0){
cout << "Impossivel calcular";
return 0;
}
double r1 = (-b+sqrt(delta)) / (2*a); //这两行记得加括号,不然运算顺序不对!
double r2 = (-b-sqrt(delta)) / (2*a);
printf("R1 = %.5lf\nR2 = %.5lf", r1, r2);
return 0;
}