結果
| 問題 |
No.1179 Quadratic Equation
|
| コンテスト | |
| ユーザー |
tenten
|
| 提出日時 | 2020-08-24 22:14:52 |
| 言語 | Java (openjdk 23) |
| 結果 |
AC
|
| 実行時間 | 162 ms / 2,000 ms |
| コード長 | 573 bytes |
| コンパイル時間 | 3,095 ms |
| コンパイル使用メモリ | 76,428 KB |
| 実行使用メモリ | 54,940 KB |
| 最終ジャッジ日時 | 2024-11-06 10:48:27 |
| 合計ジャッジ時間 | 4,961 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 11 |
ソースコード
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