#439: 自己跑好好的...


AOI (阿葵)


#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

#440: Re:自己跑好好的...


POOHccc ()


#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;     
      }


#441: Re:自己跑好好的...


POOHccc ()


#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");   
}