Four. (This question is worth 50 points)
$a_{1}, a_{2}, \ldots a_{100}$ is a permutation of $1,2, \ldots, 100$, $S_{k}=a_{1}+a_{2}+\ldots+a_{k}$, how many perfect squares can there be at most among $S_{1}, S_{2}, \ldots, S_{100}$?
Four, Solution: There are at most 60 perfect squares.
From the problem, we have $S_{1}<S_{2}<\ldots<S_{100}=5050$, and $71^{2}<5050<72^{2}$, so the perfect squares in $S_{1}, S_{2}, \ldots, S_{100}$ all belong to the set $\left\{1^{2}, 2^{2}, \ldots, 71^{2}\right\}$. Let $S_{1}, S_{2}, \ldots, S_{100}$ have at most $t$ perfect squares, denoted in increasing order as $1 \leq S_{i_{1}}<S_{i_{2}}<\ldots<S_{i_{1}} \leq 71^{2}$. When the first 50 numbers are $1,3,5, \ldots, 97,99$, we know that $t \geq 50$; if $S_{i_{r}}, S_{i_{r+1}}$ have different parities, then $a_{i_{r}+1}, a_{i_{r}+2}, \ldots, a_{i_{r+1}}$ must contain at least one odd number, and there are exactly 50 odd numbers in $1,2, \ldots, 100$, so among the $t$ pairs $\left(0, S_{i_{1}}\right),\left(S_{i_{1}}, S_{i_{2}}\right), \ldots,\left(S_{i_{i-1}}, S_{i_{i}}\right)$, at most 50 pairs have different parities, thus at least $(t-50)$ pairs have the same parity. Since each pair with the same parity loses at least one perfect square, the number of perfect squares in $S_{i_{1}}, S_{i_{2}}, \ldots, S_{i_{i}}$ does not exceed $71-(t-50)=121-t$, thus $t \leq 121-t$, therefore we have $t \leq 60$. Below is a construction for $t=60$ (we construct in a certain order):
$1,3,5, \ldots, 97,99 ; 20,40,62,82 ; 22,42,64,84 ; 24,44,66,86 ; 26,46,68,88$; $28,48,70,90$; $30,50,72,92$; $32,52,74,94$; $34,54,76,96 ; 36,56,78,98 ; 38,58,80,100$; $2,4,6,8,10,12,14,16,18,60$

From the above construction, we have
$$
S_{i}=\left\{\begin{array}{cl}
i^{2}, & 1 \leq i \leq 50 \\
\left(\frac{i}{2}+25\right)^{2}, & i=54,58,62,66,70,74,78,82,86,90
\end{array}\right.
$$

At this point, $S_{1}, S_{2}, \ldots, S_{100}$ contain exactly 60 perfect squares.