15
1
I have been recently told to read an entire physics textbook by the new year (true story, unfortunately). I need your help to determine what chapters I should read each day. This is where you come in.
Input
- Two dates, in any format. The second date will always be later than the first.
- A list of chapter numbers. This comma-separated list can contain single chapters (
12
) or inclusive ranges (1-3
). Ex.1-3,5,6,10-13
. - A list of weekdays (represented by the first two letters of the name:
Monday -> Mo
) to exclude from the schedule. Ex.Mo,Tu,Fr
.
Output
Output will be a newline-separated list of dates and chapter numbers (see format below). The chapters should be evenly distributed over all days in the range, excluding the weekdays provided. If the chapters do not distribute evenly, have the days with lower amounts of chapters at the end of the period of time. Dates in output can be in a different format than input. Days with no chapters can be ommited, or just have no chapters with it.
Example:
Input: 9/17/2015 9/27/2015 1-15 Tu
Output:
9/17/2015: 1 2
9/18/2015: 3 4
9/19/2015: 5 6
9/20/2015: 7 8
9/21/2015: 9 10
9/23/2015: 11
9/24/2015: 12
9/25/2015: 13
9/26/2015: 14
9/27/2015: 15
The input in the example should be `9/17/2015 9/27/2015 1-15 Tu' because 9/22 is a Tuesday. – DavidC – 2015-11-17T21:23:09.663
@DavidCarraher you are right, when I made that sample input I was thinking of November for some reason. – GamrCorps – 2015-11-17T21:36:58.057
7If it was me the last date would have all the chapters :) – MickyT – 2015-11-17T23:29:01.193
@MickyT precisely my inspiration for this challenge. – GamrCorps – 2015-11-18T03:05:48.580
You'll soon discover how much amazing physics is. You're lucky actually. – Fabrizio Calderan – 2015-11-23T15:21:56.277