結果

問題 No.1179 Quadratic Equation
ユーザー 👑 rin204rin204
提出日時 2022-01-18 22:29:30
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 39 ms / 2,000 ms
コード長 311 bytes
コンパイル時間 329 ms
コンパイル使用メモリ 82,048 KB
実行使用メモリ 51,968 KB
最終ジャッジ日時 2024-05-02 19:33:48
合計ジャッジ時間 1,326 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 34 ms
51,456 KB
testcase_01 AC 35 ms
51,712 KB
testcase_02 AC 39 ms
51,456 KB
testcase_03 AC 39 ms
51,456 KB
testcase_04 AC 37 ms
51,456 KB
testcase_05 AC 34 ms
51,712 KB
testcase_06 AC 33 ms
51,584 KB
testcase_07 AC 34 ms
51,712 KB
testcase_08 AC 35 ms
51,968 KB
testcase_09 AC 34 ms
51,584 KB
testcase_10 AC 33 ms
51,712 KB
testcase_11 AC 33 ms
51,584 KB
testcase_12 AC 37 ms
51,584 KB
testcase_13 AC 33 ms
51,584 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

a, b, c = map(int, input().split())

d = b * b - 4 * a * c

if d > 0:
    x1 = (-b + (b * b - 4 * a * c) ** 0.5) / (2 * a)
    x2 = (-b - (b * b - 4 * a * c) ** 0.5) / (2 * a)
    if x1 < x2:
        print(x1, x2)
    else:
        print(x2, x1)
elif d == 0:
    print(-b / (2 * a))
else:
    print("imaginary")
0