A $5 \times 5$ chessboard consists of unit squares, 7 of which are red and 18 are blue. Two of the red squares are located on the edge of the board. The segments that separate two adjacent red squares are also colored red. The segments that separate two adjacent blue squares are colored blue. All other segments, including the edges of the board, are black. In this way, a total of 35 black segments are formed. How many red segments are there?
I. solution. Imagine we build this board from separate squares. Then the 7 red squares will have 28 red sides, and the 18 blue squares will have 72 blue sides. In addition, take 20 black sides, which we attach to the edge of the board. When two sides of different colors are joined, the edge will be black; if two sides of the same color are joined, the edge will be the same color as the sides. 20 black edges are given at the edge of the board, in addition to which we need 15 more. We get this by joining 15 blue and 15 red sides. Thus, 13 red and 57 blue sides remain.

There are two red squares at the edge of the board, so there can be 2, 3, or 4 red sides at the edge of the board. However, the number of remaining red sides must be even, as more red sides cannot touch blue sides. Thus, there are 3 red sides at the edge of the board, and 10 red sides remain. From these 10 sides, 5 red edges (segments separating squares) will be formed, so the number of red segments is 5.

| $K$ | $K$ | $K$ | $K$ | $K$ |
| :---: | :---: | :---: | :---: | :---: |
| $K$ | $P$ | $P$ | $P$ | $K$ |
| $K$ | $P$ | $K$ | $K$ | $K$ |
| $K$ | $P$ | $K$ | $K$ | $K$ |
| $K$ | $K$ | $K$ | $P$ | $P$ |

A possible arrangement is shown in the diagram.

II. solution. On a $5 \times 5$ chessboard, there are 60 lines. Of these, 20 are on the outer boundary, each of which is black. Therefore, 15 black lines can be found within the grid. 7 red squares have a total of $7 \cdot 4=28$ lines if they are not joined. Since exactly 2 red squares are on the edge of the board, out of the 28 lines of the red squares, 2, 3, or 4 are black on the edge. Let's denote this number by $x$. Out of the 28 lines of the red squares, $(28-x)$ are found inside the $5 \times 5$ square. From these $(28-x)$ lines, we know that 15 are black, so the remainder forms the red lines, the number of which is

$$
\frac{(28-x)-15}{2}
$$

since 2 lines of two red squares form one red line. Since the number of red lines is an integer, $x$ must be odd, so $x=3$. From this, $\frac{10}{2}=5$ red lines are present.

III. solution. Since there are a total of 35 black edges, of which 20 are located at the edge of the board, 15 black edges can be found at the boundary between a blue and a red square.

Consider the center of the 25 squares as the vertices of a graph, and the segments separating the squares as the edges of the graph. Keep the coloring.

Then, from 7 red vertices, a total of at least $4 \cdot 5+2 \cdot 2=24$ edges start. (This is the case when the two red squares at the edge of the board are in the corners, so the corresponding vertices have a degree of 2.) If the degree of one of the "edge" red vertices is 3, then 25 edges start from the red vertices in total, and if both are 3, then 26 edges start from the red vertices in total. Among these edges, the red ones were counted twice, and the black ones once. Since the number of black edges is 15, the number of red ones is 9, 10, or 11. Of these, only 10 is even, and this is twice the number of red edges, which is 5 in this case.