Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- w n=('0'<$[2..length a])++a where a=show n
- x s=tail.foldr(\a b->s:a++b)""
- ms n(r,s)|n`mod`2^(r+1)`div`2^r>0=s|1<2=""
- tm n=x ':'[w$n`div`2^11,w$n`mod`2^11`div`32,w$2*n`mod`64]
- dt n=x '/'[w$1980+n`div`2^9,w$n`mod`2^9`div`32,w$n`mod`32]
- k=snd.span(==' ')
- y a|all(==' ')a=""|1<2='.':k a
- nm=(\(a,b)->k a++y b).splitAt 8
- pa s=x ' '[nm.map(toEnum.v.take 8).takeWhile(not.null)$iterate(drop 8)a,t,dt$v i,tm$v g,dt$v o,tm$v m,show u]where{z n=splitAt(8*n);(a,b)=z 11 s;(c,d)=z 1 b;(e,f)=z 2 d;(g,h)=z 2 f;(i,j)=z 2 h;(k,l)=z 4 j;(m,n)=z 2 l;(o,p)=z 2 n;(q,r)=z 2 p;t=(zip[0..](words"RO H S VL SD A")>>=).ms$v c;u|any(`elem`t)"LD"=0|1<2=v r;v=foldl((+).(2*))0.map(read.pure)
- main=interact pa
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement