If you let apartments at charge the revenue is:

If you charge the number of apartments let is:

So the Revenue is:

which you are to find the maximum of as changes, you will have to do some checking at the end to make sure you have let an integer number of apartments.

CB