結果

問題 No.1179 Quadratic Equation
ユーザー fuppy_kyopro
提出日時 2020-08-21 21:40:51
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 465 bytes
コンパイル時間 164 ms
コンパイル使用メモリ 82,824 KB
実行使用メモリ 80,384 KB
最終ジャッジ日時 2024-10-15 05:26:46
合計ジャッジ時間 2,707 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 9 WA * 2
権限があれば一括ダウンロードができます

ソースコード

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