#8510: AC:JAVA


beastgame (多多)


import java.util.Scanner;
public class JAVA {
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        while (input.hasNext()) {
            int a = input.nextInt();
            int b = input.nextInt();
            int c = input.nextInt();
            double Discriminant = Math.sqrt(b * b - 4 * a * c);
            if (Discriminant > 0) {
                int x1 = (int) (-b + Discriminant) / (2 * a);
                int x2 = (int) (-b - Discriminant) / (2 * a);
                System.out.println("Two different roots x1=" + x1 + " , " + "x2=" + x2);
            } else if (Discriminant == 0) {
                int x = (int) (-b + Discriminant) / (2 * a);
                System.out.println("Two same roots x=" + x);
            } else {
                System.out.println("No real root");
            }
        }
    }
}
#9963: Re:AC:JAVA


q0978298512 (超人)


請問大大這題錯在哪裡
#10090: Re:AC:JAVA


framerkyc (Martin)


請問大大這題錯在哪裡

 



請問Math.sqrt是哪裡來的?