結果

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

ソースコード

diff #

a,b,c=map(int,input().split())
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:
        if b>0:
            ans1=(-b-(b**2-4*a*c)**0.5)/(2*a)
        else:
            ans1=(-b+(b**2-4*a*c)**0.5)/(2*a)
        ans2=c/(a*ans1)
        print(2)
        print(min(ans1,ans2))
        print(max(ans1,ans2))
else:
    if b!=0:
        print(1)
        print(-c/b)
    else:
        if c!=0:
            print(0)
        else:
            print(-1)
0