帮帮孩子为什么只有60分啊 2.4.5.8都WA了
查看原帖
帮帮孩子为什么只有60分啊 2.4.5.8都WA了
1132685
ONicklgzh楼主2023/11/8 20:03
#include <stdio.h>
#include <math.h>
int main(){
	double a,b,c,disc,x1,x2,p,q;
	scanf("%lf %lf %lf",&a,&b,&c);
	disc=b*b-4*a*c;
	if (disc>0){
	p=-b/(2.0*a);
	q=sqrt(disc)/(2.0*a);
	x1=p+q;x2=p-q;
	printf("x1=%.5lf;x2=%.5lf",x1,x2);
	}else if (disc=0){
		p=-b/(2.0*a);
		printf("x1=x2=%.5lf",2*p);
	}
	else{
	printf("No answer!");
	}
	return 0;
	}
2023/11/8 20:03
加载中...