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.

15 lines
358 B
MiniZinc

include "alldifferent.mzn";
int: n;
array[1..n] of var 1..n: x; % 数字的序列
array[1..n-1] of var 1..n-1: u; % 差的序列
constraint alldifferent(x);
constraint alldifferent(u);
constraint forall(i in 1..n-1)(u[i] = abs(x[i+1] - x[i]));
solve :: int_search(x, first_fail, indomain_min, complete)
satisfy;
output ["x = ",show(x),"\n"];