結果

問題 No.955 ax^2+bx+c=0
ユーザー AEn
提出日時 2022-06-15 20:01:15
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 433 bytes
コンパイル時間 286 ms
コンパイル使用メモリ 81,920 KB
実行使用メモリ 52,480 KB
最終ジャッジ日時 2024-10-04 17:25:18
合計ジャッジ時間 7,415 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 77 WA * 45
権限があれば一括ダウンロードができます

ソースコード

diff #

import math as m
a,b,c = map(int, input().split())
if a == 0:
    if b == 0:
        if c == 0:
            print(-1)
        else:
            print(0)
    else:
        print(1,c/b,sep='\n')
else:
    if b*b-4*a*c>=0:
        p,q=(-b-m.sqrt(b*b-4*a*c))/2/a,(-b+m.sqrt(b*b-4*a*c))/2/a
        if p>q:p,q=q,p
        if p!=q:
            print(2,p,q,sep='\n')
        else:
            print(1,p,sep='\n')
    else:
        print(0)
0