問題一覧 > 通常問題

No.955 ax^2+bx+c=0

レベル : / 実行時間制限 : 1ケース 2.000秒 / メモリ制限 : 512 MB / 小数誤差許容問題 絶対誤差または相対誤差が $10^{-11}$ 以下。ただし、ジャッジ側の都合で500桁未満にしてください
タグ : (AC するまで非表示) / 解いたユーザー数 121
作問者 : trineutron / テスター : nmnmnmnmnmnmnm
お気に入りにしたユーザー ProblemId : 3606 / 自分の提出
問題文最終更新日: 2022-04-26 01:57:21
ax^2+bx+c=0
This statement was translated by AI (claude-opus-5-5, effort medium) and may contain errors or differ in nuance from the original. The original statement takes precedence. Show the original
Advent Calendar Contest 2019 (順位表) の他の問題:

Problem Statement

For the equation $ax^2+bx+c=0$ with integer coefficients $a, b, c$, determine whether the number of real solutions is finite. If it is finite, output the number of solutions and the solutions; if it is infinite, output $-1$.

Input

$a\ b\ c$

All inputs are integers.
$-10^9 \le a, b, c \le 10^9$

Output

If the number of real solutions is finite, output the number of real solutions $N$ on the first line. Then output the real solutions on the following $N$ lines, in ascending order. Your answer is considered correct if the smaller of the absolute error and the relative error is at most $10^{-11}$.

If there are infinitely many real solutions, output $-1$.

(Added by the administrators on 12/18 13:03) Be careful, as numerical errors occur easily.
Print a newline at the end.

Sample

Sample 1
Input
1 -1 -1
Output
2
-0.61803398874989479
1.6180339887498949

Sample 2
Input
-500000000 1000000000 -500000000
Output
1
1

Sample 3
Input
999 999 999
Output
0

提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。