Day 4: 198
This commit is contained in:
parent
1677642df3
commit
539a031bad
3 changed files with 1011 additions and 0 deletions
5
day4.hs
Normal file
5
day4.hs
Normal file
|
@ -0,0 +1,5 @@
|
|||
p q l=sum[1|i<-l,q i>=0]
|
||||
v c l|(h,_:t)<-break(==c)l=[h,t]
|
||||
d[a,b,c,d]|a<c=b-d|a==c=0|let=d-b
|
||||
e[a,b,c,d]|a<c=b-c|a==c=0|let=d-a
|
||||
main=interact$show.((,).p d<*>p e).map((map read.v '-'=<<).v ',').lines
|
6
day4short
Normal file
6
day4short
Normal file
|
@ -0,0 +1,6 @@
|
|||
2-4,6-8
|
||||
2-3,4-5
|
||||
5-7,7-9
|
||||
2-8,3-7
|
||||
6-6,4-6
|
||||
2-6,4-8
|
Loading…
Add table
Reference in a new issue