#29203: _cpp


80280@gsuite.essh.kl.edu.tw (p114-顏佑翰)


#include <iostream>

#include <cmath>

using namespace std;

 

 

 

void ans()

{

int a, b, c, x1, x2;

while (cin >> a >> b >> c) {

if (pow(2, b) - 4 * a * c >= 0)

{

x1 = (-b + sqrt(pow(b, 2) - 4 * a * c)) / 2 * a;

x2 = (-b - sqrt(pow(b, 2) - 4 * a * c)) / 2 * a;

if (x1 != x2)

{

cout << "Two different roots " << "x1" << "=" << x1 << ",x2" << "=" << x2;

}

else {

cout << "Two same roots " << "x" << "=" << x1;

}

}

 

else {

cout << "No real root" << endl;

}

}

 

 

}

 

int main()

{

ans();

}