結果
| 問題 |
No.1179 Quadratic Equation
|
| コンテスト | |
| ユーザー |
ks2m
|
| 提出日時 | 2020-08-21 21:57:17 |
| 言語 | Java (openjdk 23) |
| 結果 |
AC
|
| 実行時間 | 168 ms / 2,000 ms |
| コード長 | 527 bytes |
| コンパイル時間 | 2,218 ms |
| コンパイル使用メモリ | 76,400 KB |
| 実行使用メモリ | 42,780 KB |
| 最終ジャッジ日時 | 2024-10-15 05:37:10 |
| 合計ジャッジ時間 | 5,097 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| 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