1. Given a positive integer $n$, real numbers $x_{1}, x_{2}, \cdots, x_{n}$ satisfy $\sum_{k=1}^{n} x_{k}$ is an integer. Let
$$
d_{k}=\min _{m \in \mathbf{Z}}\left|x_{k}-m\right|(1 \leqslant k \leqslant n) .
$$

Find the maximum value of $\sum_{k=1}^{n} d_{k}$.
(Leng Gangsong)
1. Let's assume $x_{1}, x_{2}, \cdots, x_{n} \in (0,1]$. Otherwise, a translation transformation of an integer can be applied to $x_{i} (i=1,2, \cdots, n)$, which does not affect the conclusion of the problem.
Let $\sum_{i=1}^{n} x_{i}=t$. Then, $0 \leqslant t \leqslant n (t \in \mathbf{Z}_{+})$.
Assume $x_{1}, x_{2}, \cdots, x_{k} \leqslant \frac{1}{2}$,
$x_{k+1}, x_{k+2}, \cdots, x_{n} > \frac{1}{2}$.
Then $\sum_{i=1}^{n} d_{i} = \sum_{i=1}^{k} x_{i} + \sum_{i=k+1}^{n} (1 - x_{i})$
$= 2 \sum_{i=1}^{k} x_{i} + n - k - t$.
Notice that, $\sum_{i=1}^{k} x_{i} \leqslant \frac{k}{2}$,
$$
\begin{array}{l}
\sum_{i=1}^{k} x_{i} = t - \sum_{i=k+1}^{n} x_{i} \leqslant t - \frac{n-k}{2}. \\
\text{Thus, } \sum_{i=1}^{n} d_{i} \leqslant \min \{k, 2 t - n + k\} + n - k - t \\
= \min \{n - t, t\} \leqslant \left[\frac{n}{2}\right],
\end{array}
$$

where $[x]$ denotes the greatest integer not exceeding the real number $x$.
When $n$ is odd, take
$$
x_{1} = x_{2} = \cdots = x_{n-1} = \frac{1}{2}, x_{n} = 0 \text{; }
$$

When $n$ is even, take
$$
x_{1} = x_{2} = \cdots = x_{n} = \frac{1}{2} \text{. }
$$

In both cases, $\sum_{i=1}^{n} d_{i} = \left[\frac{n}{2}\right]$.
In summary, the maximum value sought is $\left[\frac{n}{2}\right]$.