#28773: 我只是留個紀錄給自己看


david14@go.edu.tw (Yuan)


#include <iostream>
#include <math.h>
using namespace std;

int main() {

int a, b, c, d, x1, x2;
cin >> a >> b >> c;
d = b*b - 4*a*c;

if (d < 0)
cout << "No real root";
else if (d == 0)
cout << "Two same roots x=" << (-b) / (2*a);
else
cout << "Two different roots x1=" << ((-b) + sqrt(d))/ (2*a)
<< " , x2=" << ((-b) - sqrt(d))/ (2*a);

return 0;
}