HHC 2016 RPN contest is now live
|
09-19-2016, 05:20 AM
Post: #8
|
|||
|
|||
RE: HHC 2016 RPN contest is now live
My algorithm calculates the number of numbers of the required length or shorter that digit sum to the correct amount and then subtracts the number of numbers of one less than the required length -- this was the quick way to handle leading zeros and still get a direct combinatorial solution.
I didn't figure out a combinatorial solution that dealt with leading zeros properly and I suspect I'm missing something really obvious. It wasn't a great weekend for me Code: LBL B The END doesn't count (I hope), the initial LBL B can be omitted. Using the assembler, we can get relative subroutine calls which saves a step. Without this add LBL 01 between steps 7 and 8 and change the two BSR a to XEQ 01 and add one step. It uses four registers. I suspect this can be further optimised, I really didn't spend a lot of time on this. The program doesn't deal with out of range inputs since the clarification that they weren't allowed. It should scale up to larger input values too. Pauli |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 1 Guest(s)