Q:

How many squares contains paint

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? 

A:

Hint:  how many vertical and horizontal lines does the paintbrush cross?  You need to think about the width of the brush.  Draw a picture for a few small cases.

