Killed 錯誤甚麼意思?????
#include<stdio.h>
#include<math.h>
int main()
{
int a=0,b=0,c=0;
while(scanf("%d%d%d",&a,&b,&c)!=0)
{
int R1=0,R2=0;
int decide=0;
decide=(pow(b,2)-(4*a*c));
if(decide>0)
{
R1=((-b+pow(decide,0.5))/(2*a));
R2=((-b-pow(decide,0.5))/(2*a));
if(R1<R2)
{
int T=R1;R1=R2;R2=T;
}
printf("Two different roots x1=%d , x2=%d\n",R1,R2);
}
if(decide==0)
{
R1=(-b/(2*a));
printf("Two same root x=%d\n",R1);
}
if(decide<0)
{
printf("No real root\n");
}
}
return 0;
}
Killed 錯誤甚麼意思?????
#include
#include
int main()
{
int a=0,b=0,c=0;
while(scanf("%d%d%d",&a,&b,&c)!=0)
{
int R1=0,R2=0;
int decide=0;
decide=(pow(b,2)-(4*a*c));
if(decide>0)
{
R1=((-b+pow(decide,0.5))/(2*a));
R2=((-b-pow(decide,0.5))/(2*a));
if(R1<R2)
{
int T=R1;R1=R2;R2=T;
}
printf("Two different roots x1=%d , x2=%d\n",R1,R2);
}
if(decide==0)
{
R1=(-b/(2*a));
printf("Two same root x=%d\n",R1);
}
if(decide<0)
{
printf("No real root\n");
}
}
return 0;
}
就是超時,你的whlie裡面可以改成!=EOF,
還有,是"Two same roots" 你少打了s