import java.util.Scanner;
public class a006 {
public static void main(String[] args) {
Scanner sc= new Scanner(System.in);
int a = sc.nextInt();
int b = sc.nextInt();
int c = sc.nextInt();
int h = (b*b)-(4*a*c);
double d = Math.sqrt(h);
int x1 = (int)(-b + d)/(2*a);
int x2 = (int)(-b - d)/(2*a);
if(h>0) {
System.out.printf("Two different roots x1="+x1+" , x2="+x2);
}else if(h==0) {
System.out.printf("Two same roots x="+x1);
}else {
System.out.printf("No real root");
}
}
}
import java.util.Scanner;
public class a006 {
public static void main(String[] args) {
Scanner sc= new Scanner(System.in);
int a = sc.nextInt();
int b = sc.nextInt();
int c = sc.nextInt();
int h = (b*b)-(4*a*c);
double d = Math.sqrt(h);
int x1 = (int)(-b + d)/(2*a);
int x2 = (int)(-b - d)/(2*a);
if(h>0) {
System.out.printf("Two different roots x1="+x1+" , x2="+x2);
}else if(h==0) {
System.out.printf("Two same roots x="+x1);
}else {
System.out.printf("No real root");
}
}
}
求解