1
0
This repository has been archived on 2025-03-06. You can view files and clone it, but cannot push or open issues or pull requests.

12 lines
338 B
MiniZinc

int: n; % 拉丁方的大小
array[1..n,1..n] of var 1..n: a;
include "alldifferent.mzn";
constraint forall(i in 1..n)(
alldifferent(j in 1..n)(a[i,j]) /\
alldifferent(j in 1..n)(a[j,i])
);
solve satisfy;
output [ show(a[i,j]) ++ if j == n then "\n" else " " endif |
i in 1..n, j in 1..n ];