Day 2: 220

This commit is contained in:
Christoph Stahl 2021-12-04 02:50:21 +01:00
parent 5a2408185d
commit 2ad826759e

View file

@ -3,5 +3,4 @@ q(h:f:_)[d:_,n]|'f'==d=[h,f+r n]|let=[d%h$r n,f]
p[h,f,a][d:_,n]|'f'==d=[h+r n,f+r n*a,a]|let=[h,f,d%a$r n]
(%)'u'=(-)
(%)_=(+)
m=map
main=interact$show.m(\(a:b:_)->a*b).(`m`[p,q]).flip(`foldl`[0,0,0]).m words.lines
main=interact$show.map(\(a:b:_)->a*b).(<$>[p,q]).flip(`foldl`[0,0,0]).map words.lines