結果

問題 No.955 ax^2+bx+c=0
ユーザー tanon710
提出日時 2020-05-04 19:10:15
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 467 bytes
コンパイル時間 399 ms
コンパイル使用メモリ 82,560 KB
実行使用メモリ 80,768 KB
最終ジャッジ日時 2024-06-24 20:54:26
合計ジャッジ時間 16,635 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 102 WA * 20
権限があれば一括ダウンロードができます

ソースコード

diff #

from decimal import *

a,b,c=map(int,input().split())
a=Decimal(a)
b=Decimal(b)
c=Decimal(c)
if a!=0:
    if b*b-4*a*c<0:
        print(0)
    elif b*b==4*a*c:
        print(1)
        print(-b/(2*a))
    elif b*b>4*a*c:
        print(2)
        print((-b-(b*b-4*a*c).sqrt())/(2*a))
        print((-b+(b*b-4*a*c).sqrt())/(2*a))
else:
    if b!=0:
        print(1)
        print(-c/b)
    else:
        if c!=0:
            print(0)
        else:
            print(-1)
0