結果
| 問題 |
No.955 ax^2+bx+c=0
|
| コンテスト | |
| ユーザー |
mkawa2
|
| 提出日時 | 2021-04-11 17:08:13 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,339 bytes |
| コンパイル時間 | 206 ms |
| コンパイル使用メモリ | 12,672 KB |
| 実行使用メモリ | 11,392 KB |
| 最終ジャッジ日時 | 2024-06-27 11:50:52 |
| 合計ジャッジ時間 | 6,837 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 72 WA * 50 |
ソースコード
import sys
sys.setrecursionlimit(10**6)
int1 = lambda x: int(x)-1
p2D = lambda x: print(*x, sep="\n")
def II(): return int(sys.stdin.buffer.readline())
def FI(): return float(sys.stdin.buffer.readline())
def LI(): return list(map(int, sys.stdin.buffer.readline().split()))
def LI1(): return list(map(int1, sys.stdin.buffer.readline().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def LLI1(rows_number): return [LI1() for _ in range(rows_number)]
def BI(): return sys.stdin.buffer.readline().rstrip()
def SI(): return sys.stdin.buffer.readline().rstrip().decode()
# dij = [(0, 1), (-1, 0), (0, -1), (1, 0)]
# dij = [(0, 1), (-1, 0), (0, -1), (1, 0), (1, 1), (1, -1), (-1, 1), (-1, -1)]
dij = [(0, 1), (1, 0), (1, 1), (1, -1)]
inf = 10**16
# md = 998244353
md = 10**9+7
from decimal import *
a, b, c = map(Decimal, SI().split())
# 問題で「方程式」って言ってるから本当はa=b=0はナシだと思うけど念の為
if a == b == 0:
if c == 0:
print(-1)
else:
print(0)
elif a == 0:
ans = -c/b
print(1, ans)
elif b**2-4*a*c > 0:
a0 = (-b-(b**2-4*a*c).sqrt())/(2*a)
a1 = (-b+(b**2-4*a*c).sqrt())/(2*a)
print(2)
print(f"{a0:.12f}")
print(f"{a1:.12f}")
elif b**2-4*a*c == 0:
a0 = -b/(2*a)
print(1)
print(f"{a0:.12f}")
else:
print(0)
mkawa2