結果
問題 | No.955 ax^2+bx+c=0 |
ユーザー |
👑 ![]() |
提出日時 | 2021-01-01 18:26:23 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 596 bytes |
コンパイル時間 | 448 ms |
コンパイル使用メモリ | 82,048 KB |
実行使用メモリ | 80,384 KB |
最終ジャッジ日時 | 2024-10-11 12:09:19 |
合計ジャッジ時間 | 20,295 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 89 WA * 33 |
ソースコード
from math import sqrtimport decimaldecimal.getcontext().prec=20a,b,c=map(int,input().split())D=b*b-4*a*cif a==0:if b==0:if c==0:print(-1)else:print(0)else:print(1)b=decimal.Decimal(b)c=decimal.Decimal(c)print(-c/b)else: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))