結果
| 問題 |
No.955 ax^2+bx+c=0
|
| コンテスト | |
| ユーザー |
lam6er
|
| 提出日時 | 2025-03-20 19:00:51 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 645 bytes |
| コンパイル時間 | 186 ms |
| コンパイル使用メモリ | 82,176 KB |
| 実行使用メモリ | 54,472 KB |
| 最終ジャッジ日時 | 2025-03-20 19:02:11 |
| 合計ジャッジ時間 | 8,422 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 97 WA * 25 |
ソースコード
import math
a, b, c = map(int, input().split())
if a == 0:
if b == 0:
if c == 0:
print(-1)
else:
print(0)
else:
x = (-c) / b
print(1)
print("{0:.15g}".format(x))
else:
D = b * b - 4 * a * c
if D < 0:
print(0)
elif D == 0:
x = (-b) / (2 * a)
print(1)
print("{0:.15g}".format(x))
else:
sqrtD = math.sqrt(D)
x1 = (-b - sqrtD) / (2 * a)
x2 = (-b + sqrtD) / (2 * a)
if x1 > x2:
x1, x2 = x2, x1
print(2)
print("{0:.15g}".format(x1))
print("{0:.15g}".format(x2))
lam6er