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