[code]
import java.util.Scanner;
public class a006 {
public static void main(String[] args) {
Scanner s=new Scanner(System.in);
String a="",b="",c="";
while(s.hasNext())
{
a=s.nextLine();
b=s.nextLine();
c=s.nextLine();
System.out.println(ans(a)+ans(b)+ans(c));
}
}
static String ans(String str)
{
String anss="";
String x[]=str.split(" ");
double n[]=new double[x.length];
double a,b,c;
a=Double.parseDouble(x[0]);
b=Double.parseDouble(x[1]);
c=Double.parseDouble(x[2]);
double d1=(double)(Math.pow(b,2)-(4*a*c));//B平方-4AC;
double ans1,ans2,ans3,ans4,temp=0;
ans3=(double)(Math.pow(d1,0.5));
ans4=Math.pow(d1,0.5);//根號B平方-4AC;
if(d1>0)
{
ans1=(double)((-b+ans4)/(2*a));
ans2=(double)((-b-ans4)/(2*a));
if(ans1<ans2)
{
temp=ans1;
ans1=ans2;
ans2=temp;
}
anss+="Two different roots x1="+(int)ans1+" , x2="+(int)ans2+"\n";
}else if(d1==0)
{
ans1=(double)(-1*b*((2*a)*0.5));
anss+="Two same roots x="+(int)ans1+"\n";
}else if(d1<0)
{
anss+="No real root\n";
}
return anss;
}
}
[/code]
請問這個是哪裡錯阿= ="?