## Task A-2.3.

Each of the four walls of the room needs to be painted with one color so that adjacent walls are not the same color. If we have three different colors available, in how many ways can the room be painted? It is not necessary to use all the colors.
## Solution.

Let's label the walls in a circular order as $A, B, C,$ and $D$ (where $A$ is adjacent to $B$ and $D$, etc.).

The given coloring can be done using either two or three colors.

If we use only two colors, we can choose one of the three colors to paint wall $A$, and then one of the remaining two colors to paint wall $B$. The colors of the remaining walls are then uniquely determined - wall $C$ must be the same color as $A$, and wall $D$ must be the same color as $B$.

Thus, there are $3 \cdot 2 = 6$ ways to paint the walls using two colors.

1 point

If we use all three colors, similarly, we can choose one of the three colors to paint wall $A$ and then one of the remaining two colors to paint wall $B$. We distinguish two cases: wall $C$ is the same color as wall $A$, and the third color is used on wall $D$, or wall $D$ is the same color as wall $B$, and the third color is used on wall $C$.

Thus, there are $3 \cdot 2 \cdot 2 = 12$ ways to paint the walls using three colors.

In total, there are $6 + 12 = 18$ different colorings.

Note: Only the result, i.e., the answer without explanation, is worth 1 point.