結果

問題 No.955 ax^2+bx+c=0
ユーザー AEnAEn
提出日時 2022-06-15 20:16:03
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 44 ms / 2,000 ms
コード長 376 bytes
コンパイル時間 398 ms
コンパイル使用メモリ 82,176 KB
実行使用メモリ 52,736 KB
最終ジャッジ日時 2024-10-04 17:58:26
合計ジャッジ時間 8,394 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 122
権限があれば一括ダウンロードができます

ソースコード

diff #

a,b,c=map(int,input().split())
D=b*b-4*a*c
if a == 0:
    if b == 0:
        print(-1 if c==0 else 0)
    else:
        print(1,-c/b,sep='\n')
else:
    if D==0:
        print(1,-b/a/2,sep='\n')
    elif D<0:
        print(0)
    else:
        if b<0:
            a,b,c=-a,-b,-c
        p=(-b-D**(0.5))/2/a
        q=c/a/p
        if p>q:p,q=q,p
        print(2,p,q,sep='\n')
0