Day 2: 229
This commit is contained in:
parent
e55fee94b1
commit
41711114e9
1 changed files with 2 additions and 1 deletions
|
@ -1,4 +1,5 @@
|
|||
q(h:f:_)(d,n)|"f"==d=[h,f+n]|let=[d%h$n,f]
|
||||
p[h,f,a](d,n)|"f"==d=[h+n,f+n*a,a]|let=[h,f,d%a$n]
|
||||
(%)d|"f"<d=(-)|let=(+)
|
||||
(%)"u"=(-)
|
||||
(%)_=(+)
|
||||
main=interact$show.(<$>[p,q]).((\(a:b:_)->a*b).).flip(`foldl`[0,0,0]).map(fmap read.splitAt 1.map head.words).lines
|
Loading…
Add table
Reference in a new issue