結果
問題 |
No.1179 Quadratic Equation
|
ユーザー |
![]() |
提出日時 | 2025-03-20 18:55:04 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 40 ms / 2,000 ms |
コード長 | 420 bytes |
コンパイル時間 | 359 ms |
コンパイル使用メモリ | 82,904 KB |
実行使用メモリ | 53,900 KB |
最終ジャッジ日時 | 2025-03-20 18:56:57 |
合計ジャッジ時間 | 1,384 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 11 |
ソースコード
import math a, b, c = map(int, input().split()) D = b ** 2 - 4 * a * c if D < 0: print("imaginary") else: if D == 0: x = (-b) / (2 * a) print("{0:.15f}".format(x)) else: sqrt_d = math.sqrt(D) x1 = (-b - sqrt_d) / (2 * a) x2 = (-b + sqrt_d) / (2 * a) sorted_roots = sorted([x1, x2]) print("{0:.15f} {1:.15f}".format(sorted_roots[0], sorted_roots[1]))