Post Reply 
HHC 2018 Programming Contests
10-06-2018, 12:48 PM
Post: #81
RE: HHC 2018 Programming Contests
(10-06-2018 11:42 AM)Gerson W. Barbosa Wrote:  This saves 47 bytes overall.

We can also use Werner's remark:
(10-01-2018 01:42 PM)Werner Wrote:  The period for 23x28 and 28x33 days is also halved to 322 and 462, respectively.

Code:
\<< RCLF RAD
  { 190 305 454 569 949 }
  { 91 371 553 }
  { 63 259 385 }
  5 ROLL DUP DATE DUP ROT ROT DDAYS
  { 322 462 759 } MOD
  { } 1 3
  FOR i SWAP DUP i GET
    6 ROLL SWAP - DUP 0 > *
    WHILE DUP HEAD NOT
    REPEAT TAIL
    END 1 GET ROT +
  NEXT SWAP DROP SORT HEAD DATE+ DUP ROT ROT DDAYS \PI *
  { 11.5 14 16.5 } / SIN 100 * 0 RND ROT STOF
\>>

Meanwhile I came up with something between your and 3298's solution:
Code:
«
  DATE DDAYS
  {
    { 63 259 385 }
    { 190 305 454 569 949 }
    { 91 371 553 }
  }
  OVER
  { 322 759 462 } MOD
  2
  « -
    WHILE DUP HEAD DUP 0 ≤
    REPEAT DROP TAIL
    END SWAP DROP
  » DOLIST
  SORT HEAD DATE OVER DATE+ ROT ROT +
  360 * { 23 28 33 } / SIN 100 * 0 RND
»

But I consider 3298's idea to calculate the difference, then the remainder, flatten the lists and only then sort the result more elegant. Only drawback is the use of:
Code:
1. +

Kind regards
Thomas
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
HHC 2018 Programming Contests - Joe Horn - 09-13-2018, 02:17 PM
RE: HHC 2018 Programming Contests - pier4r - 09-13-2018, 06:29 PM
RE: HHC 2018 Programming Contests - Zaphod - 09-13-2018, 10:10 PM
RE: HHC 2018 Programming Contests - Gene - 09-13-2018, 10:56 PM
RE: HHC 2018 Programming Contests - Gene - 09-14-2018, 12:06 AM
RE: HHC 2018 Programming Contests - Jlouis - 09-19-2018, 07:00 PM
RE: HHC 2018 Programming Contests - sasa - 09-19-2018, 11:17 AM
RE: HHC 2018 Programming Contests - pier4r - 09-29-2018, 07:41 PM
RE: HHC 2018 Programming Contests - 3298 - 09-30-2018, 05:32 PM
RE: HHC 2018 Programming Contests - 3298 - 09-30-2018, 08:47 PM
RE: HHC 2018 Programming Contests - Gene - 09-29-2018, 07:22 PM
RE: HHC 2018 Programming Contests - Gene - 10-01-2018, 02:55 AM
RE: HHC 2018 Programming Contests - sasa - 10-01-2018, 05:31 AM
RE: HHC 2018 Programming Contests - sasa - 10-01-2018, 09:54 AM
RE: HHC 2018 Programming Contests - 3298 - 10-01-2018, 06:37 AM
RE: HHC 2018 Programming Contests - Werner - 10-01-2018, 01:42 PM
RE: HHC 2018 Programming Contests - Werner - 10-02-2018, 06:10 AM
RE: HHC 2018 Programming Contests - Namir - 10-04-2018, 06:09 PM
RE: HHC 2018 Programming Contests - Werner - 10-03-2018, 02:03 PM
RE: HHC 2018 Programming Contests - Werner - 10-04-2018, 05:55 AM
RE: HHC 2018 Programming Contests - 3298 - 10-04-2018, 02:48 PM
RE: HHC 2018 Programming Contests - 3298 - 10-05-2018, 08:26 PM
RE: HHC 2018 Programming Contests - 3298 - 10-06-2018, 12:07 PM
RE: HHC 2018 Programming Contests - Thomas Klemm - 10-06-2018 12:48 PM
RE: HHC 2018 Programming Contests - 3298 - 10-06-2018, 04:21 PM



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