結果
問題 | No.955 ax^2+bx+c=0 |
ユーザー |
👑 ![]() |
提出日時 | 2021-01-01 18:31:18 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 637 bytes |
コンパイル時間 | 266 ms |
コンパイル使用メモリ | 82,048 KB |
実行使用メモリ | 80,384 KB |
最終ジャッジ日時 | 2024-10-11 12:11:29 |
合計ジャッジ時間 | 17,166 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 97 WA * 25 |
ソースコード
from math import sqrtimport decimaldecimal.getcontext().prec=100a,b,c=map(int,input().split())if a<0:a=-ab=-bc=-cif 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*ca=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))