結果
| 問題 | No.1179 Quadratic Equation |
| コンテスト | |
| ユーザー |
tenten
|
| 提出日時 | 2020-08-24 22:13:50 |
| 言語 | Java (openjdk 23) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 573 bytes |
| 記録 | |
| コンパイル時間 | 2,235 ms |
| コンパイル使用メモリ | 76,104 KB |
| 実行使用メモリ | 56,956 KB |
| 最終ジャッジ日時 | 2024-11-06 10:48:19 |
| 合計ジャッジ時間 | 5,036 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 WA * 1 |
| other | AC * 3 WA * 8 |
ソースコード
import java.util.*;
public class Main {
public static void main (String[] args) {
Scanner sc = new Scanner(System.in);
double a = sc.nextInt();
double b = sc.nextInt();
double c = sc.nextInt();
double d = b * b - 4 * a * c;
if (d < 0) {
System.out.println("imaginary");
} else if (d == 0) {
System.out.println(-b / 2/ a);
} else {
double x = (-b - Math.sqrt(d)) / 2 / a;
double y = (-b - Math.sqrt(d)) / 2 / a;
System.out.println(Math.min(x, y) + " " + Math.max(x, y));
}
}
}
tenten