Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Command: tr '-' ' ' </tmp/input | dc -fdc-p1.dc
- # read ranges section onto stack
- 0 ? # end start i
- [
- 3R d3R r:r # range(i) = end; i start
- 1+ d3R r:r # range(++i) = start; i
- 1+ ? z1<L
- ] dsLx # length of range array left on stack
- [ lc1+sc q ] sC
- # count food ids that fall in a range
- ?
- [
- sf d # i=num | num (length of array)
- [
- 1- d;r lf- # end-food i
- r 1- d;r lf- # start-food i end-food
- 3R* # (start-food)*(end-food) i
- 0!<C # if test <= 0 then count and quit
- d0<I
- ] dsIx s.
- ? z1<M
- ] dsMx
- [Part 1: ]n lcp
Advertisement
Add Comment
Please, Sign In to add comment