You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

15 lines
373 B

\l ../l/maths.k
D:(|-1 1*)\!2
I:{T/(0;x;0;y;!0)}
E:99=100!@/|2#
Am:{@[$[y<#x;x;x,(0|y+1-#x)#0];y;:;z]}
Tf:(+/;*/;</;=/)
T:{[i;a;r;u;v]
(p;q;R):(a;::;r+a@)[10!-100 -1000 -10000!'a i]@'i+1 2 3
c:100!a i
$[c=3;(a;u):(Am[a;p;*u];1_u)
c=4;v,:a p
|/c=5 6;i:$[2!c+~a p;a q;3+i]
-1<j:1 2 7 8?c;a:Am[a;R;Tf[j]a p,q]
c=9;r+:a p]
(i+0|0 4 4 2 2 0 0 4 4 2 c;a;r;u;v)}.