結果
| 問題 | No.955 ax^2+bx+c=0 |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2019-12-18 15:58:29 |
| 言語 | PyPy2 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 164 ms / 2,000 ms |
| コード長 | 518 bytes |
| 記録 | |
| コンパイル時間 | 584 ms |
| コンパイル使用メモリ | 77,396 KB |
| 最終ジャッジ日時 | 2025-12-04 02:02:19 |
|
ジャッジサーバーID (参考情報) |
judge1 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 122 |
ソースコード
#!/usr/bin/python2
# -*- coding: utf-8 -*-
# †
from decimal import *
def f(a, b, c):
if a == 0:
if b == 0:
return [-1] if c == 0 else [0]
return [1, -c/b]
else:
D = b*b - 4*a*c
if D < 0:
return [0]
if D == 0:
return [1, -b/(2*a)]
return [2, (-b-D.sqrt())/(2*a), (-b+D.sqrt())/(2*a)]
a, b, c = map(Decimal, raw_input().split())
res = f(a, b, c)
print res[0]
for token in sorted(res[1:]):
print '{:.30f}'.format(token)