#include <stdio.h>
#include <math.h>
main() {
int i,a,b,c,d,e,f;
while((i = scanf("%d%d%d",&a,&b,&c))!= EOF){
d=(-b+sqrt(b*b-4*a*c))/2*a;
e=(-b-sqrt(b*b-4*a*c))/2*a;
f=b*b-4*a*c;
if(f>=0&&d!=e)
printf("Two different roots x1=%d , x2=%d",d,e);
else if(f==0&&d==e)
printf("Two same roots x=%d",e);
else
printf("No real root");
}
return 0 ;
}
*** 第 5 點 (20%):WA
與正確輸出不相符(line:1)
您的答案為: Two same roots x=-4
正確答案為: Two same roots x=-1
d=(-b+sqrt(b*b-4*a*c))/2*a;
e=(-b-sqrt(b*b-4*a*c))/2*a;