A5. D) 20 The first requirement states that the number of black squares in a column cannot be equal to the number of black squares in the column directly to the right (or left) of it. From the second requirement, it follows that the number of black squares in a column also cannot be equal to the number of black squares in the second column to the right (or left) of it. The numbers of black squares in the first three columns must therefore be different, and once we know these, we also know the numbers of black squares in the last two columns.

The possibilities for the numbers of black squares in the five columns are:

$$
\begin{array}{lll}
0-1-2-0-1, & 0-2-1-0-2, & 1-0-2-1-0, \\
1-2-0-1-2, & 2-0-1-2-0, & 2-1-0-2-1 .
\end{array}
$$

If there must be 0 or 2 black squares in a column, then this can only happen in 1 way. If there must be 1 black square in a column, then this can happen in 2 ways.

The combinations $0-2-1-0-2$ and $2-0-1-2-0$ can each occur in 2 ways, and the other four combinations can each occur in $2 \times 2=4$ ways. In total, there are thus $2 \times 2+4 \times 4=20$ possibilities.
5. In a table with two rows and five columns, each of the ten cells is colored black or white according to these rules:

- Two columns that are directly next to each other must never have the same number of black cells.
- Two $2 \times 2$ squares that overlap in one column must never contain the same number of black cells.

How many possible colorings of such a table exist that comply with these rules?
A) 6
B) 8
C) 12
D) 20
E) 24