about summary refs log tree commit diff
path: root/day24.k
blob: 3bc50bc0f664312e05a8b28d66438f28c955fc1b (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
d:0$'0:"day24";

/ n:3;
n:4;

/ stupid eager brute forcing
r:{b::n#0; p:: (n;0)#(); { p[*<b],:x; b[*<b]+:x }'x; :[b~n#(+/d)%n; p; ()]};

s:{x::();
 while[x~();x::r[d@(-#d)?#d]];
 m::m& */x@*<#:'x;
 `0:($m),"\n";};

m:0I;
while[1;s[]];