I read a book containing competition level problems. I was unable to solve the following:
Consider an $n\times m$ grid. A paintbrush whose width is the same as the width of a grid square is used to paint a line from one corner of the grid to the opposite corner. How many squares will have paint in their interiors?
How can I solve this?