結果
| 問題 |
No.955 ax^2+bx+c=0
|
| コンテスト | |
| ユーザー |
koyopro
|
| 提出日時 | 2020-01-25 15:42:52 |
| 言語 | PyPy2 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 163 ms / 2,000 ms |
| コード長 | 697 bytes |
| コンパイル時間 | 1,288 ms |
| コンパイル使用メモリ | 76,800 KB |
| 実行使用メモリ | 88,192 KB |
| 最終ジャッジ日時 | 2024-09-14 04:06:28 |
| 合計ジャッジ時間 | 24,423 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 122 |
ソースコード
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(min(ans0, ans1)))
print("{:.16f}".format(max(ans0, ans1)))
solve()
koyopro