5 lines
198 B
Haskell
5 lines
198 B
Haskell
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
|