90分求助大佬qwq
查看原帖
90分求助大佬qwq
1282944
sxLiang_1229楼主2024/10/3 22:35
#include<bits/stdc++.h>
using namespace std;
int main(){
	double a,b,c;
	scanf("%lf%lf%lf",&a,&b,&c);
	double x1,x2;
	x1=(-b+sqrt(b*b-4*a*c))/(2*a);
	x2=(-b-sqrt(b*b-4*a*c))/(2*a);
	if(b*b-4*a*c==0){
		printf("x1=x2=%lf",x1);
	}else if(b*b-4*a*c<0){
		puts("No answer!");
	}else{
		printf("x1=%.5lf;x2=%.5lf",min(x1,x2),max(x1,x2));
	}
	return 0;
} 
2024/10/3 22:35
加载中...