aboutsummaryrefslogtreecommitdiff
path: root/day04/part1.mzn
diff options
context:
space:
mode:
Diffstat (limited to 'day04/part1.mzn')
-rw-r--r--day04/part1.mzn27
1 files changed, 27 insertions, 0 deletions
diff --git a/day04/part1.mzn b/day04/part1.mzn
new file mode 100644
index 0000000..eccd08a
--- /dev/null
+++ b/day04/part1.mzn
@@ -0,0 +1,27 @@
+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]
+ );
+
+constraint
+ increasing(digits);
+
+output [show(code)];
+
+solve satisfy;