Multiple Dwellings
Published:
First read the problem description.
Prolog is the perfect tool for this problem. Gprolog has a finite domain solver builtin, which makes the solution simple.
Source code of the solution(s):