Post Reply 
HHC 2021 Programming Contests - Surprise !
10-04-2021, 12:16 AM (This post was last modified: 10-04-2021 12:42 AM by John Keith.)
Post: #6
RE: HHC 2021 Programming Contests - Surprise !
I have two similar solutions for the RPL programming challenge. The first is the smallest, weighing in at 91.5 bytes and taking about 9.7 seconds on an HP 50g for a = 500 and b = 1000.

Code:

\<< \-> a b
  \<< 1. 2. b
    FOR k k OVER - PICK PICK 1. +
    NEXT b \->LIST a b SUB SQ \GSLIST
  \>>
\>>

My second solution is a bit larger (108 bytes) and a bit faster (about 8.9 seconds for the same values as above).

Code:

\<< \-> a b
  \<< 1. 2. b
    FOR k k OVER - PICK PICK 1. +
    NEXT 0. a b
    START SWAP SQ +
    NEXT a ROLLD a 1. - DROPN
  \>>
\>>


I do have a couple of minor grumbles regarding the contest rules which can be illustrated by the two programs.

I personally prefer the scoring method of (size in bytes) times (execution speed in seconds) regardless of program size. I recall this being the standard for most previous HHC contests although my memory may be faulty. My second program, though larger, does better on the size times speed metric but the current scoring rules favor the first program which is slower.

The other aspect I am grumbling about is that the second program will run on the 28S and 48S as long as the maximum value is, say, 1,000 instead of 10,000 so I question the need to exclude calculators earlier than the 48G. Including the earlier machines may even be seen as making the contest more challenging.

All grumbling aside, a thoroughly enjoyable contest and I eagerly await seeing the winning programs and all others as well.

Edit: 3298 posted while I was composing my post and made most of my points previously as well as providing superior and nicely commented programs. Bravo!
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: HHC 2021 Programming Contests - Surprise ! - John Keith - 10-04-2021 12:16 AM



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