Problem D
D Fyrir Dreki
Languages
en
is
Daði Dreki is always practising on how to become more brave and next up for him is to see how brave he is in the world of mathematics. As everyone knows, only the most daring and bravest can find the roots of a second degree polynomial and thus Daði wants to become one of them. There is one thing that really gets in Daði’s way, that is that some second degree polynomials can have one, two or no real valued roots. Thus he asks you for help in finding how many real valued roots exist to any given second degree polynomial has. Can you help Daði to become more brave?
A second degree real polynomial is an expression of the form
$ax^2 + bx + c$ where
$a$, $b$ and $c$ are given real numbers with
$a \neq 0$ and
$x$ is a variable.
Example of such a polynomials are:
-
$-2x^2 + 7x - 1$ where $a = -2$, $b = 7$ and $c = -1$
-
$x^2 - 9$ where $a = 1$, $b = 0$ and $c = - 9$
-
$10x^2 - x$ where $a = 10$, $b = -1$ and $c = 0$
Input
Input consists of three lines, each one contains one integer. The first line contains the value of $a$, the second line contains the value of $b$, and the third line contains the value of $c$. The integers $a, b$ and $c$ are the coefficients of the second degree polynomial $ax^2 + bx + c$, where $-100 \leq a, b, c \leq 100$ and $a \neq 0$.
Output
Output how many real valued roots Daði’s second degree polynomial has.
Scoring
Group |
Points |
Constraints |
1 |
30 |
There always exist two real roots |
2 |
30 |
Either two or no real roots |
3 |
40 |
No further constraints |
Sample Input 1 | Sample Output 1 |
---|---|
-5 1 1 |
2 |
Sample Input 2 | Sample Output 2 |
---|---|
1 1 1 |
0 |
Sample Input 3 | Sample Output 3 |
---|---|
2 4 2 |
1 |