```
#include<bits/stdc++.h>
using namespace std;
double a,b,c,x1,x2,s;
int main()
{
cin >> a >> b >> c ;
s = b * b - 4 * a * c ;
x1 = (-b + sqrt(s)) / (2 * a) ;
x2 = (-b - sqrt(s)) / (2 * a) ;
if(x1>x2)
swap(x1,x2);
if (s > 0)
{
printf("x1=%0.5lf;x2=%0.5lf" , x1 , x2);
}
else if (s == 0)
{
printf("x1=x2=%0.5lf",x1);
}
else
{
printf("No answer!") ;
}
return 0;
}
```
如果x1>x2,交换一下
喵喵喵
by drinktowind @ 2024-03-27 13:23:19
@drinktowi
谢谢你♪(・ω・)ノ
喵~
by python18 @ 2024-03-28 20:58:24