5. Let $n \geqslant 2$ be a positive integer. Find all sets $A$ containing $n$ integers such that the sum of all elements in any non-empty subset of $A$ cannot be divisible by $n+1$.
Let $A=\left\{a_{1}, a_{2}, \cdots, a_{n}\right\}$,
$$
S_{k}=\sum_{i=1}^{k} a_{i}(k=1,2, \cdots, n) .
$$

According to the problem, $\left\{S_{k}\right\}$ contains all non-zero residues modulo $(n+1)$, and $a_{2}, S_{2}, S_{3}, \cdots, S_{n}$ also contain all non-zero residues modulo $(n+1)$. Therefore,
$$
\begin{array}{l}
a_{1}=S_{1} \equiv a_{2}(\bmod (n+1)), \\
a_{i} \equiv a_{1}(\bmod (n+1)) .
\end{array}
$$

Thus, for any $k(1 \leqslant k \leqslant n)$,
$$
\begin{array}{l}
a_{1}+a_{2}+\cdots+a_{k} \equiv k a_{1} \neq 0(\bmod (n+1)) . \\
\text { Hence, }\left(a_{1}, n+1\right)=1 . \\
\text { Therefore, } A=\left\{a+k_{i}(n+1) \mid k_{i} \in \mathbf{Z}, 1 \leqslant i \leqslant n\right\},
\end{array}
$$

where $a \in \mathbf{Z},(a, n+1)=1$ is the solution.