Example 5 Given that $x_{1}, x_{2}, \cdots, x_{10}$ are all positive integers, and $x_{1}+x_{2}+\cdots+x_{10}=2005$, find the maximum and minimum values of $x_{1}^{2}+x_{2}^{2}+\cdots+x_{10}^{2}$.
Solve: The number of ways to write 2005 as the sum of 10 positive integers is finite, so there must be a way that maximizes or minimizes the sum of their squares.

If the positive integers $x_{1}, x_{2}, \cdots, x_{10}$ satisfy $x_{1}+x_{2}+\cdots+x_{10}=2005$, and $x_{1}^{2}+x_{2}^{2}+\cdots+x_{10}^{2}$ reaches its maximum.

Assume without loss of generality that $x_{1} \leqslant x_{2} \leqslant \cdots \leqslant x_{10}$. If $x_{1}>1$, then $x_{1}+x_{2}=\left(x_{1}-1\right)+\left(x_{2}+1\right)$. $\left[\left(x_{1}-1\right)^{2}+\left(x_{2}+1\right)^{2}\right]-\left(x_{1}^{2}+x_{2}^{2}\right)=-2 x_{1}+2 x_{2}+2=2\left(x_{2}-x_{1}\right)+2 \geqslant 2$. Therefore, replacing $x_{1}, x_{2}$ with $x_{1}-1, x_{2}+1$ keeps their sum unchanged but increases the sum of their squares. This contradicts the assumption that $x_{1}^{2}+x_{2}^{2}+\cdots+x_{10}^{2}$ is maximized, so $x_{1}=1$.
Similarly, $x_{2}=x_{3}=\cdots=x_{9}=1, x_{10}=1996$.
Thus, the maximum value of $x_{1}^{2}+x_{2}^{2}+\cdots+x_{10}^{2}$ is: $9+1996^{2}=3984025$.
Now assume $x_{1} \leqslant x_{2} \leqslant \cdots \leqslant x_{10}$, satisfying $x_{1}+x_{2}+\cdots+x_{10}=2005$, and $x_{1}^{2}+x_{2}^{2}+\cdots+x_{10}^{2}$ reaches its minimum value. If there exist $x_{i}, x_{j}$ and $x_{j}-x_{i} \geqslant 2(j>i)$, then $\left[\left(x_{j}-1\right)^{2}+\left(x_{i}+1\right)^{2}\right]-\left(x_{j}^{2}+x_{i}^{2}\right)=-2 x_{j}+2 x_{i}+2=2\left(x_{i}-x_{j}\right)+2 \leqslant-2$. Therefore, replacing $x_{j}, x_{i}$ with $x_{j}-1, x_{i}+1$ keeps their sum unchanged but decreases the sum of their squares, contradicting the assumption that $x_{1}^{2}+x_{2}^{2}+\cdots+x_{10}^{2}$ is minimized. Thus, the absolute difference between any two of $x_{1}, x_{2}, \cdots, x_{10}$ is at most 1. Therefore, these 10 numbers can only be 5 instances of 200 and 5 instances of 201. Thus, the minimum value is $5 \times 200^{2}+5 \times 201^{2}=402005$.