Day 10: 304
This commit is contained in:
parent
b9f7afeb25
commit
bb39a1764d
1 changed files with 8 additions and 0 deletions
8
d10golf.hs
Normal file
8
d10golf.hs
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
import Data.List
|
||||||
|
e=fromEnum
|
||||||
|
n%(h:t)|h`elem`"([{<"=(h:n)%t|i:s<-n,abs(e h-e i)<3=s%t|let=(0,a[h])
|
||||||
|
n%_=(foldl((.b).(+).(5*))0 n,0)
|
||||||
|
a")"=3;a"]"=57;a"}"=1197;a">"=25137;a _=0
|
||||||
|
b '('=1;b '['=2;b '{'=3;b _=4
|
||||||
|
m l=l!!(length l`div`2)
|
||||||
|
main=interact$show.((,).m.filter(>0).sort.map fst<*>sum.map snd).map(""%).lines
|
Loading…
Add table
Reference in a new issue