結果
問題 | No.955 ax^2+bx+c=0 |
ユーザー |
![]() |
提出日時 | 2020-01-25 13:35:08 |
言語 | PyPy2 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 675 bytes |
コンパイル時間 | 1,314 ms |
コンパイル使用メモリ | 76,672 KB |
実行使用メモリ | 88,320 KB |
最終ジャッジ日時 | 2024-09-14 04:05:01 |
合計ジャッジ時間 | 23,297 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 102 WA * 20 |
ソースコード
from decimal import * a,b,c = [Decimal(int(x)) for x in raw_input().split()] def solve(): if (a==0 and b==0): print(-1 if (c==0) else 0) return if (a==0): print(1) ans = -c/b print("{:.16f}".format(ans)) return border = Decimal(b*b - 4 * a * c) if (border < 0): print(0) return if (border == 0): print(1) ans = -b / Decimal(2) / a print("{:.16f}".format(ans)) return q = border.sqrt() ans0 = (-b + q) / Decimal(2) / a ans1 = (-b - q) / Decimal(2) / a print(2) print("{:.16f}".format(ans1)) print("{:.16f}".format(ans0)) solve()