| Constraint Programming | ||||||||
![]() |
||||||||
| The University of York CONSTRAINT SATISFACTION AND COMBINATORIAL OPTIMISATION Open Examination An n-by-n magic square is an grid with n columns and n rows in which each element of the grid contains a different integer and all rows, all columns and the main diagonals sum to the same value. If S is a finite set of integers, a magic square for S is one in which each element of the grid contains a member of S. Write a program that given S determines whether or not there is a 3-by-3 magic square for S. |
||||||||