結果

問題 No.955 ax^2+bx+c=0
ユーザー hir355hir355
提出日時 2020-02-14 22:42:28
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
WA  
実行時間 -
コード長 520 bytes
コンパイル時間 244 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 11,392 KB
最終ジャッジ日時 2024-10-06 13:01:43
合計ジャッジ時間 7,398 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 102 WA * 20
権限があれば一括ダウンロードができます

ソースコード

diff #

from math import sqrt
from decimal import *
getcontext().prec = 20
a, b, c = map(int, input().split())
if a == 0:
    if b == 0:
        if c == 0:
            print(-1)
        else:
            print(0)
    else:
        print(1)
        print(-c / b)
else:
    d = b ** 2 - 4 * a * c
    if d > 0:
        print(2)
        print(float((-b - Decimal(d).sqrt()) / (2 * a)))
        print(float((-b + Decimal(d).sqrt()) / (2 * a)))
    elif d < 0:
        print(0)
    else:
        print(1)
        print(-b / (2 * a))
0