#include<stdio.h>
#include<math.h>
main()
{double a,b,c,x,y;
while(scanf("%lf%lf%lf",&a,&b,&c)!=EOF)
{x=(-b+sqrt(b*b-4*a*c))/(2*a);
y=(-b-sqrt(b*b-4*a*c))/(2*a);
if((b*b-4*a*c)==0) printf("Two same roots x=%d",(int)x);
if((b*b-4*a*c)>0) printf("Two different roots x1=%d , x2=%d",(int)x,(int)y) ;
if((b*b-4*a*c)<0) printf("No real root");
}
return 0;
}
為什麼我的錯誤訊息是...
與正確輸出不相符(line:1)
您的答案為: Two different roots x1=2 , x2=-5Two s ...略
正確答案為: Two different roots x1=2 , x2=-5
#include<stdio.h>
#include<math.h>
main()
{double a,b,c,x,y;
while(scanf("%lf%lf%lf",&a,&b,&c)!=EOF)
{x=(-b+sqrt(b*b-4*a*c))/(2*a);
y=(-b-sqrt(b*b-4*a*c))/(2*a);
if((b*b-4*a*c)==0) printf("Two same roots x=%d",(int)x);
if((b*b-4*a*c)>0) printf("Two different roots x1=%d , x2=%d",(int)x,(int)y) ;
if((b*b-4*a*c)<0) printf("No real root");
}
return 0;
}
為什麼我的錯誤訊息是...
與正確輸出不相符(line:1)
您的答案為: Two different roots x1=2 , x2=-5Two s ...略
正確答案為: Two different roots x1=2 , x2=-5
#include<stdio.h>
#include<math.h>
main()
{double a,b,c,x,y;
while(scanf("%lf%lf%lf",&a,&b,&c)!=EOF)
{x=(-b+sqrt(b*b-4*a*c))/(2*a);
y=(-b-sqrt(b*b-4*a*c))/(2*a);
if((b*b-4*a*c)==0) printf("Two same roots x=%d\n",(int)x);
if((b*b-4*a*c)>0) printf("Two different roots x1=%d , x2=%d\n",(int)x,(int)y) ;
if((b*b-4*a*c)<0) printf("No real root\n");
}
return 0;
}
#include<stdio.h>
#include<math.h>
main()
{double a,b,c,x,y;
while(scanf("%lf%lf%lf",&a,&b,&c)!=EOF)
{x=(-b+sqrt(b*b-4*a*c))/(2*a);
y=(-b-sqrt(b*b-4*a*c))/(2*a);
if((b*b-4*a*c)==0) printf("Two same roots x=%d",(int)x);
if((b*b-4*a*c)>0) printf("Two different roots x1=%d , x2=%d",(int)x,(int)y) ;
if((b*b-4*a*c)<0) printf("No real root");
}
return 0;
}
為什麼我的錯誤訊息是...
與正確輸出不相符(line:1)
您的答案為: Two different roots x1=2 , x2=-5Two s ...略
正確答案為: Two different roots x1=2 , x2=-5