Day 11: 482
This commit is contained in:
parent
94de56b7b8
commit
c8a1a9cdde
1 changed files with 14 additions and 0 deletions
14
d11golf.hs
Normal file
14
d11golf.hs
Normal file
|
@ -0,0 +1,14 @@
|
|||
m=map.map
|
||||
(?)=splitAt
|
||||
w=filter
|
||||
y=maybe
|
||||
n=Nothing
|
||||
v g m(x,y)|x>=0,y>=0,(f,r:b)<-x?m,(h,c:t)<-y?r=f++(h++g c:t):b|let=m
|
||||
s(x,y)=(,)<$>[x-1..x+1]<*>[y-1..y+1]
|
||||
m#(x,y)=m!!x!!y
|
||||
a=[0..9]
|
||||
p!m=w(p.(m#))$(,)<$>a<*>a
|
||||
(%)i j z=((i+1,j+length((==n)!z)),m(y 0 id)z)
|
||||
t((n,j),i)=n%j$l$m(pure.(+1))i
|
||||
l i|a@(h:t)<-y(2<1)(>9)!i=l$foldl(v((+1)<$>))(foldl(v(pure n))i a)$s=<<a|let=i
|
||||
main=interact$show.((,).(fst.fst.(head.w(all(==0).concat.snd)))<*>snd.fst.(!!100)).iterate t.(,)(0,0).m(read.pure).lines
|
Loading…
Add table
Reference in a new issue