結果
| 問題 | No.1179 Quadratic Equation |
| コンテスト | |
| ユーザー |
ks2m
|
| 提出日時 | 2020-08-21 21:57:17 |
| 言語 | Java (openjdk 25.0.2) |
| 結果 |
AC
|
| 実行時間 | 101 ms / 2,000 ms |
| コード長 | 527 bytes |
| 記録 | |
| コンパイル時間 | 2,383 ms |
| コンパイル使用メモリ | 83,108 KB |
| 実行使用メモリ | 42,832 KB |
| 最終ジャッジ日時 | 2026-05-03 04:28:39 |
| 合計ジャッジ時間 | 4,815 ms |
|
ジャッジサーバーID (参考情報) |
judge3_1 / judge1_1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 11 |
ソースコード
import java.util.Scanner;
public class Main {
public static void main(String[] args) throws Exception {
Scanner sc = new Scanner(System.in);
int a = sc.nextInt();
int b = sc.nextInt();
int c = sc.nextInt();
sc.close();
int d = b * b - 4 * a * c;
if (d < 0) {
System.out.println("imaginary");
} else if (d == 0) {
System.out.println(-b / 2.0 / a);
} else {
double d2 = Math.sqrt(d);
d2 = Math.abs(d2 / 2 / a);
double e = -b / 2.0 / a;
System.out.println(e - d2 + " " + (e + d2));
}
}
}
ks2m