Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Command: dc -fdc-p2-nosentinel.dc <input 2>/dev/null
- # Redirecting the error for popping an empty stack to /dev/null
- # Read Input
- ?
- [
- # stack: item2 item1
- d;b 1+ r:b # b(item2)++
- Sa # push item1 on stack a
- ? z0<I
- ] dsIx
- # Process
- 0 La # item sum
- [
- d;b *+ # sum += b(item) * item
- La z1<L
- ] dsLx
- [Part 2: ]np
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement