Question 238, Given a positive integer $\mathrm{n}$, write the positive integers $1, 2, \ldots, \mathrm{n}$ on paper, where some numbers are written in red ink and some in blue ink, with both colors used, and each number is written in only one color. For $1 \leq i \leq j \leq n$, if the numbers written in blue ink among $i, i+1, \ldots, j$ are exactly odd in number, then the pair $(i, j)$ is called "good". Find the maximum possible number of good pairs.
Question 238, Solution: Let $a_{i}=\left\{\begin{array}{c}-1, \text { when } i \text { is written in blue } \\ 1, \text { when } i \text { is written in red }\end{array}(1 \leq i \leq n)\right.$ . Let $T_{k}=\prod_{i=1}^{k} a_{i}(1 \leq k \leq$ $n)$, and let $T_{0}=1$. According to the condition, $(i, j)$ is a good pair if and only if $T_{i-1}$ and $T_{1}$ have different signs.

Let there be $x$ ones and $y$ negative ones in $T_{0}, T_{1}, \ldots, T_{n}$, then $x+y=n+1$, and the number of good pairs is $x y \leq$ $\left\lceil\frac{n+1}{2}\right\rceil\left\lceil\frac{n+1}{2}\right\rceil=\left[\frac{(n+1)^{2}}{4}\right]$.

On the other hand, if we write $\left[\frac{n}{2}\right]+1$ in blue and the rest in red, then $x=\left\lceil\frac{n}{2}\right\rceil+1, y=\left\lceil\frac{n}{2}\right\rceil$. In this case, there are exactly $\left[\frac{(n+1)^{2}}{4}\right]$ good pairs.