結果
| 問題 |
No.955 ax^2+bx+c=0
|
| コンテスト | |
| ユーザー |
titia
|
| 提出日時 | 2019-12-18 04:25:15 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 631 bytes |
| コンパイル時間 | 303 ms |
| コンパイル使用メモリ | 12,416 KB |
| 実行使用メモリ | 11,264 KB |
| 最終ジャッジ日時 | 2024-07-07 00:31:24 |
| 合計ジャッジ時間 | 6,438 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 97 WA * 25 |
ソースコード
a,b,c=map(int,input().split())
import math
from decimal import *
getcontext().prec = 50
ANS=[]
if a!=0:
if b**2-4*a*c>0:
print(2)
ANS.append((Decimal(-b)+Decimal(math.sqrt(b**2-4*a*c)))/Decimal(2*a))
ANS.append((Decimal(-b)-Decimal(math.sqrt(b**2-4*a*c)))/Decimal(2*a))
for a in sorted(ANS):
print(a)
elif b**2-4*a*c==0:
print(1)
print(Decimal(-b)/Decimal(2*a))
else:
print(0)
else:
if b!=0:
print(1)
print(Decimal(-c)/Decimal(b))
else:
if c==0:
print(-1)
else:
print(0)
titia