結果

問題 No.1179 Quadratic Equation
ユーザー fuppy_kyoprofuppy_kyopro
提出日時 2020-08-21 21:40:51
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 465 bytes
コンパイル時間 166 ms
コンパイル使用メモリ 82,304 KB
実行使用メモリ 80,512 KB
最終ジャッジ日時 2024-04-23 05:41:27
合計ジャッジ時間 2,349 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 102 ms
80,096 KB
testcase_01 AC 104 ms
80,256 KB
testcase_02 AC 99 ms
79,872 KB
testcase_03 AC 97 ms
80,128 KB
testcase_04 AC 98 ms
80,512 KB
testcase_05 AC 102 ms
80,256 KB
testcase_06 AC 99 ms
80,256 KB
testcase_07 AC 99 ms
79,972 KB
testcase_08 AC 98 ms
80,128 KB
testcase_09 AC 103 ms
80,256 KB
testcase_10 WA -
testcase_11 AC 100 ms
80,128 KB
testcase_12 AC 102 ms
79,744 KB
testcase_13 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

import decimal
from decimal import Decimal

def main():
    A, B, C = map(int, input().split())
    a = Decimal(A)
    b = Decimal(B)
    c = Decimal(C)

    k = b * b - Decimal(4) * a * c
    if k < Decimal(0):
        print("imaginary")
        return

    if k == 0:
        print(-b / (Decimal(2) * a))
    else:
        print((-b - k.sqrt()) / (Decimal(2) * a), end=' ')
        print((-b + k.sqrt()) / (Decimal(2) * a))


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