5. (7 points) Solve the equation $(\sin x)^{2018}+(\cos x)^{2018}=1$.
Solution.

Since $\sin ^{2} x+\cos ^{2} x=1$, we obtain the equation:

$$
(\sin x)^{2018}+(\cos x)^{2018}=\sin ^{2} x+\cos ^{2} x
$$

from which we have:

$$
\sin ^{2} x\left(1-\sin ^{2016} x\right)+\cos ^{2} x\left(1-\cos ^{2016} x\right)=0
$$

Since $|\sin x| \leq 1,|\cos x| \leq 1$, the equality holds only when both terms are 0. Therefore, the equation is equivalent to the system of equations:

$$
\left\{\begin{array}{l}
\sin ^{2} x\left(1-\sin ^{2016} x\right)=0 \\
\cos ^{2} x\left(1-\cos ^{2016} x\right)=0
\end{array}\right.
$$

The solution to this system is

$$
x=\frac{\pi n}{2}, \quad n \in Z
$$

Answer. $x=\frac{\pi n}{2}, n \in Z$.