No.955 ax^2+bx+c=0
タグ : / 解いたユーザー数 121
作問者 :
trineutron
/ テスター :
nmnmnmnmnmnmnm
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
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もしくは右上の雲マークをクリックしてアカウントを作成してください。