Calendar Contest Problem 2 Day of the Week Solution

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.

Input Specification

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-021752-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].

Output Specification

For each input date, output the day of the week of date dd, i.e. one of MondayTuesdayWednesdayThursdayFridaySaturday, or Sunday, on its own line.

Sample Input


Sample Output


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

  1. Sexagenary Cycle Solution
  2. Day of the Week Solution
  3. Classical Maya Solution
  4. Savvyday 29 Oatmeal 94
  5. Reign of Terror Solution
  6. Ming Dynasty Solution

1 thought on “Calendar Contest Problem 2 Day of the Week Solution”

Leave a Comment

error: Content is protected !!
Please Click on 1 or 2 Ads to help us run this site.