5. Let the function $f(x)=\lg \frac{\sum_{i=1}^{n-1} i^{x}+n^{x} a}{n}$, where $a \in \mathbf{R}$, $n$ is a given positive integer, and $n \geqslant 2$. If the inequality $f(x)>(x-1) \lg n$ has a solution in the interval $[1,+\infty)$, then the range of the real number $a$ is ( ).
(A) $a \leqslant \frac{1-n}{2}$
(B) $a>\frac{3-n}{2}$
(C) $a>\frac{1-n}{2}$
(D) $a \leqslant \frac{3-n}{2}$
5. B.
$f(x)>(x-1) \lg n$ has a solution in $[1,+\infty]$
$\Leftrightarrow \lg \frac{\sum_{i=1}^{n-1} i^{x}+n^{x} a}{n}>\lg n^{x-1}$ has a solution in $[1,+\infty)$
$\Leftrightarrow \sum_{i=1}^{n-1} i^{x}+n^{x} a>n^{x}$ has a solution in $[1,+\infty)$
$\Leftrightarrow a>1-\sum_{i=1}^{n-1}\left(\frac{i}{n}\right)^{x}$ has a solution in $[1,+\infty)$
$\Leftrightarrow a>\min \left(1-\sum_{i=1}^{n-1}\left(\frac{i}{n}\right)^{x}\right)=1-\frac{1}{n} \sum_{i=1}^{n-1} i=\frac{3-n}{2}$.