結果
| 問題 |
No.955 ax^2+bx+c=0
|
| コンテスト | |
| ユーザー |
👑 Kazun
|
| 提出日時 | 2021-01-01 18:37:50 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 639 bytes |
| コンパイル時間 | 342 ms |
| コンパイル使用メモリ | 82,304 KB |
| 実行使用メモリ | 82,816 KB |
| 最終ジャッジ日時 | 2024-10-11 12:14:23 |
| 合計ジャッジ時間 | 27,914 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 60 WA * 25 RE * 37 |
ソースコード
from math import sqrt
import decimal
decimal.getcontext().prec=10000
a,b,c=map(int,input().split())
if a<0:
a=-a
b=-b
c=-c
if a==0:
if b==0:
if c==0:
print(-1)
else:
print(0)
else:
b=decimal.Decimal(b)
c=decimal.Decimal(c)
print(1)
print(-c/b)
else:
D=b*b-4*a*c
a=decimal.Decimal(a)
b=decimal.Decimal(b)
c=decimal.Decimal(c)
if D<0:
print(0)
elif D==0:
print(1)
print(-b/(2*a))
else:
print(2)
R=decimal.Decimal(sqrt(D))
print((-b-R)/(2*a))
print((-b+R)/(2*a))
Kazun