Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- [ d2*1+2%* ] S| # abs: (2*n + 1) % 2 * n (if dc mod preserves sign)
- [
- []ps.
- ] sR # print newline
- [ 0* ] sZ # zero top of stack
- [Part 2: ]ps.
- [#]dn 0:t [ ] 1:t # print table (and print starting #)
- # stack: time regX sum
- [
- d 3R d 3R * # (regX * time) time regX sum
- 4R+ r3R # s = (s + (regX * time)), stack: time regX sum
- ] sS
- # main loop (stack: time regX sum data ...)
- [
- # Part 2
- d 40% # (time % 40) time regX sum ...
- d 0=R # print newline every 40
- 3R d 3R # (time % 40) regX regX time sum ...
- - l|x # abs( time%40 - regx ) regX time sum ...
- 1r 1!<Z # (idx := !(abs<=1)) regX time sum ...
- ;tn r # print t(idx), stack: time regX sum
- # Part 1
- 1+ # time++ regX sum ...
- d 40% # time%40 time regX sum ...
- 20=S # score if time%40 = 20, stack: time regX sum ...
- # Update regX
- r4R # pull up data: data regX time sum ...
- + # (regX += data) time sum ...
- r # time regX sum data ...
- z 3<L
- ] sL
- 0 1 d lLx
- [Part 1: ]n 3Rp
- [<END>]ps.
- [<stack>]ps. f [<bottom>]ps.
Advertisement
Comments
-
- Run with:
- tac input | tr -- '-[[:alpha:]]' '_[0*]' | dc -f- dc-p12.dc
Add Comment
Please, Sign In to add comment
Advertisement