Alternative Solution. Consider the cells adjacent to all cells of the second and fourth row. Counting multiplicity, each cell in the first and fifth row is counted once, each cell in the third row twice, while each cell in the second and fourth row is also counted twice apart from their first and last cells which are counted only once.

So there are 204 cells counted once and 296 cells counted twice. Those cells contain, counting multiplicity, at most 400 black cells. Suppose $a$ of the cells have multiplicity one and $b$ of them have multiplicity 2. Then $a+2b \leqslant 400$ and $a \leqslant 204$. Thus

$$
2a+2b \leqslant 400+a \leqslant 604
$$

and so $a+b \leqslant 302$ as required.

Remark. The alternative solution shows that if we have equality, then all cells in the perimeter of the table except perhaps the two cells of the third row must be coloured black. No other cell in the second or fourth row can be coloured black as this will give a cell in the first or fifth row with at least three neighbouring black cells. For similar reasons we cannot colour black the second and last-but-one cell of the third row. So we must colour black all other cells of the third row and therefore the colouring is unique.
A $5 \times 100$ table is divided into 500 unit square cells, where $n$ of them are coloured black and the rest are coloured white. Two unit square cells are called adjacent if they share a common side. Each of the unit square cells has at most two adjacent black unit square cells. Find the largest possible value of $n$.

A $5 \times 100$ table is divided into 500 unit square cells, where $n$ of them are coloured black and the rest are coloured white. Two unit square cells are called adjacent if they share a common side. Each of the unit square cells has at most two adjacent black unit square cells. Find the largest possible value of $n$.