Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Command: dc -fdc-p1.dc <input
- [q] sQ
- [0*] sZ
- [1+] sC
- 0 # sum = 0
- [
- ? z d1=Q
- # stack: n r1 r2 ... rn sum
- 2- dsn # i=n (number of diffs)
- [
- _3Rr d # copy r2; stack: r2 r2 r1 i ...
- 3R- Sd # push diff on d stack; stack: r2 i r3 ...
- r1- d0<I # i--
- ] dsIx * # end: 0*rn
- ld+ sa # a = dn + 0
- 0 ln # i=n c=0
- [
- r Ldd d*v # abs(di) di c i ...
- 3<Z # top zeroed if >= 3
- la* 0<C # c++ if > 0
- r1- d0<I # i--
- ] dsIx + # end: 0+c
- ln /+
- lMx
- ] dsMx
- [Part 1: ]n rp
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement