Post Reply 
HHC 2022 - Programming Contest - no responses until after 6am Monday 6am CENTRAL
09-13-2022, 06:21 PM (This post was last modified: 09-15-2022 12:07 PM by Gerson W. Barbosa.)
Post: #30
RE: HHC 2022 - Programming Contest - no responses until after 6am Monday 6am CENTRAL
(09-12-2022 08:03 PM)Gerson W. Barbosa Wrote:  (# 559Ah, 221 bytes).

Code:
 « R→I -105 CF 0 SWAP
  « →STR { "0" } 1 PICK3 SIZE
    START OVER HEAD + SWAP TAIL SWAP
    NEXT NIP "0" OVER TAIL REVLIST +
  » → h
  «
    DO h EVAL ∑LIST OBJ→ SWAP ∑LIST OBJ→ + SWAP 1 + SWAP DUP h EVAL
    UNTIL == PICK3 50 ≥ OR
    END OVER 50 == { DROP2 0 DUP } IFT
  »
»

We can save a few bytes by eliminating the local variable:

Code:


« R→I -105 CF
  « →STR { "0" } 1 PICK3 SIZE
    START OVER HEAD + SWAP TAIL SWAP
    NEXT NIP "0" OVER TAIL REVLIST +
  » 0 ROT
  DO PICK3 EVAL ∑LIST OBJ→ SWAP ∑LIST OBJ→ + SWAP 1 + SWAP DUP 4 PICK EVAL
  UNTIL == PICK3 50 ≥ OR
  END ROT DROP OVER 50 == { DROP2 0 DUP } IFT
»

# 1924h, 212.5

P.S.: Or # FD3Hh and 210 bytes, if I place the subprogram between { } instead of « » (I keep on forgetting that).
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: HHC 2022 - Programming Contest - no responses until after 6am Monday 6am CENTRAL - Gerson W. Barbosa - 09-13-2022 06:21 PM



User(s) browsing this thread: 9 Guest(s)