結果

問題 No.1179 Quadratic Equation
ユーザー ThetaTheta
提出日時 2022-11-14 18:36:30
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 399 bytes
コンパイル時間 701 ms
コンパイル使用メモリ 10,748 KB
実行使用メモリ 8,068 KB
最終ジャッジ日時 2023-10-14 01:31:50
合計ジャッジ時間 1,594 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 17 ms
7,908 KB
testcase_01 AC 18 ms
8,068 KB
testcase_02 AC 17 ms
7,932 KB
testcase_03 AC 16 ms
7,880 KB
testcase_04 AC 16 ms
7,856 KB
testcase_05 AC 16 ms
8,024 KB
testcase_06 AC 16 ms
7,936 KB
testcase_07 AC 16 ms
8,028 KB
testcase_08 AC 16 ms
7,936 KB
testcase_09 AC 16 ms
7,872 KB
testcase_10 WA -
testcase_11 AC 17 ms
7,884 KB
testcase_12 AC 16 ms
8,052 KB
testcase_13 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

from math import sqrt


def main():

    a, b, c = map(int, input().split())
    root_inside = b**2 - 4*a*c
    if root_inside < 0:
        print("imaginary")
        return
    if root_inside == 0:
        print(-b/(2*a))
        return

    smaller = (-b - sqrt(root_inside)) / (2*a)
    larger = (-b + sqrt(root_inside)) / (2*a)
    print(smaller, larger)


if __name__ == "__main__":
    main()
0