Example 9 For $n \in \mathbf{N}$, let $S_{n}=\min \left(\sum_{\mathrm{k}=1}^{\mathrm{n}} \sqrt{(2 \mathrm{k}-1)^{2}+\mathrm{a}_{\mathrm{k}}^{2}}\right)$, where $\mathrm{a}_{1}$, $\mathrm{a}_{2}, \cdots, \mathrm{a}_{\mathrm{n}} \in \mathbf{R}^{+}, \sum_{i=1}^{n} a_{n}=17$, if there exists a unique $n$ such that $S_{n}$ is also an integer, find $n$.
$$
\begin{array}{l}
\text { Solution: By } \sqrt{(2 k-1)^{2}+a_{i}^{2}}=\left|(2 k-1)+a_{i} \mathrm{i}\right|,(i=1,2, \cdots, n) . \\
\quad \sum_{k=1}^{n} \sqrt{(2 k-1)^{2}+a_{k}^{2}} \\
=\left|1+a_{1} \mathrm{i}\right|+\left|3+a_{2} \mathrm{i}\right|+\cdots+\left|(2 n-1)+a_{n} \mathrm{i}\right| \\
\geqslant\left|[1+3+\cdots+(2 n-1)]+\left(a_{1}+a_{2}+\cdots+a_{n}\right) \mathrm{i}\right| \\
=\left|n^{2}+17 \mathrm{i}\right| \\
=\sqrt{n^{4}+17^{2}} .
\end{array}
$$

By $S_{n} \in \mathbf{Z}^{+}$, let $S_{n}=m$. Then we have
$$
\begin{aligned}
n^{4}+17^{2}=m^{2} & \Rightarrow\left(m-n^{2}\right)\left(m+n^{2}\right)=289 \\
& \Rightarrow\left\{\begin{array}{l}
m-n^{2}=1 \\
m+n^{2}=289
\end{array} \Rightarrow n=12 .\right.
\end{aligned}
$$