結果
問題 | No.1179 Quadratic Equation |
ユーザー | tenten |
提出日時 | 2020-08-24 22:13:50 |
言語 | Java21 (openjdk 21) |
結果 |
WA
|
実行時間 | - |
コード長 | 573 bytes |
コンパイル時間 | 2,468 ms |
コンパイル使用メモリ | 77,104 KB |
実行使用メモリ | 42,640 KB |
最終ジャッジ日時 | 2024-04-24 03:56:16 |
合計ジャッジ時間 | 5,401 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 134 ms
41,104 KB |
testcase_01 | WA | - |
testcase_02 | AC | 136 ms
41,296 KB |
testcase_03 | AC | 134 ms
41,432 KB |
testcase_04 | AC | 135 ms
41,516 KB |
testcase_05 | WA | - |
testcase_06 | WA | - |
testcase_07 | WA | - |
testcase_08 | WA | - |
testcase_09 | WA | - |
testcase_10 | WA | - |
testcase_11 | AC | 132 ms
41,228 KB |
testcase_12 | WA | - |
testcase_13 | WA | - |
ソースコード
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)); } } }