blob: ea5bbb1043bf7ed5820e4eb5deae7baf2d6fd64c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
include "globals.mzn";
par set of int: range;
array[0..5] of var 0..9: digits;
var range: code;
constraint
code =
digits[0] * 100000 +
digits[1] * 10000 +
digits[2] * 1000 +
digits[3] * 100 +
digits[4] * 10 +
digits[5];
constraint
exists (i in 0..4) (
digits[i] == digits[i+1] /\
if i > 0 then digits[i-1] != digits[i] else true endif /\
if i < 4 then digits[i+2] != digits[i] else true endif
);
constraint
increasing(digits);
output [show(code)];
solve satisfy;
|