1. Find the number of roots of the equation:
$$
\sum_{k=0}^{2018}|x+k|=x^{2}+2018 x-2019 .
$$
1. Two roots.

In the interval $(-2019,1)$, there are no roots. This is because the left side of equation (1) is non-negative, while the right side is negative.

When $x \in[1,+\infty)$, all absolute values on the left side of equation (1) are positive, so the equation takes the form $g(x)=0$, where
$$
g(x)=x^{2}-x-2009+\sum_{k=1}^{2018} k .
$$

Since $g(1)<0$, the quadratic equation has a unique root in the interval $[1,+\infty)$.

Notice that both sides of equation (1) are symmetric about the line $x=-1009$, i.e.,
$$
f(x)=f(-2018-x) .
$$

Therefore, the number of roots in the interval $(-\infty,-2019]$ is equal to the number of roots in the interval $[1,+\infty)$, which is one root.
Thus, equation (1) has a total of two roots.