Day of the Week Solution
In history books, dates are typically mentioned, but rarely does it mention which day of the week. For example, we all know that Neil Armstrong landed on the moon on July 20, 1969, but was that a Monday? Or perhaps a Friday? (It’s actually a Sunday.)
To solve these kinds of problem once and for all, you decided to create a program that when given a date, gives the day of the week.
The first line will contain the integer N (0≤N≤1000)N (0≤N≤1000), the number of lines that follows.
Each subsequent line of input will contain a date dd in ISO 8601 format (i.e. yyyy-mm-dd). For simplicity, we consider all dates up to
1752-09-02 to be in the Julian calendar, and every date since
1752-09-14 to be in the Gregorian calendar, as it was the case in Canada (and also the US, the UK, and other places that were part of the British Empire then). Dates in the range (
1752-09-14) will not be considered valid input.
The year number will be padded to four digits, but may contain more digits if required. The year may be optionally prefixed by a
-, which represents negative year numbers. Note that year 0 means 1 BCE, year -1 means 2 BCE, etc. The year will be in the range [−109,109][−109,109].
For each input date, output the day of the week of date dd, i.e. one of
Sunday, on its own line.
Note: Please click one of our ads once we reach 20 click’s will release the solution’s. It help’s us to generate revenue and run this site
Calendar Contest Problem
- Sexagenary Cycle Solution
- Day of the Week Solution
- Classical Maya Solution
- Savvyday 29 Oatmeal 94
- Reign of Terror Solution
- Ming Dynasty Solution