您的程式被監控系統中斷,可能是程式無法正常結束所導致。 Exception in thread "main" java.util.NoSuchElementException at java.util.Scanner.throwFor(Scanner.java:862) at java.util.Scanner.next(Scanner.java:1485) at java.util.Scanner.nextDouble(Scanner.java:2413) at ZeroJudgeD623.main(ZeroJudgeD623.java:18)
題目有誤嗎?為什麼程式碼這樣過不了
package zerojudged623;
import java.util.Scanner;
/**
*
* @author Hsu
*/
public class ZeroJudgeD623 {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
Scanner input=new Scanner(System.in);
while(input.hasNext()){
double a=input.nextDouble();
double b=input.nextDouble();
double c=input.nextDouble();
double d=input.nextDouble();
double det=a*d-b*c;
if(a==0&&b==0&c==0&d==0){
break;
}
else if(det==0){
System.out.println("cheat!");
}
else if(det!=0){
System.out.printf("%.5f",d/det);
System.out.print(" ");
System.out.printf("%.5f",-b/det);
System.out.println();
System.out.printf("%.5f",-c/det);
System.out.print(" ");
System.out.printf("%.5f",a/det);
System.out.println();
}
}
// TODO code application logic here
}
}