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

1
1969-07-20

Sample Output

Sunday

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

4 thoughts on “Calendar Contest Problem 2 Day of the Week Solution”

  1. whoah this blog is magnificent i really like
    reading your articles. Stay up the good work! You understand, lots of individuals are looking around for this
    info, you could help them greatly.

    Reply
  2. You made some good points there. I looked on the internet for more information about the issue and found most individuals will go along with your views on this website.

    Reply
  3. Hello! This is kind of off topic but I need some advice from an established blog.
    Is it tough to set up your own blog? I’m not very techincal but I can figure
    things out pretty quick. I’m thinking about making my own but I’m not sure where to begin. Do you have any points or suggestions?
    Many thanks

    Reply
    • Setting Up your own blog is not at all hard. Few things to keep on list:
      1. What are the platforms where you can make free Blogs (Some are Quora,Blogger,Tumblr,Reddit…etc).
      2. What will be the content.
      3. Know your targeting audience(what age group of people will be benefited from your content.
      3. Selecting perfect theme(design) which perfectly showcase your blog.
      4. Pick a Time and Day of posting your content, keeps your user engaging.
      5. Sharing your blog on multiple social media’s.

      This are some basic things to know before you start a blog, once you find the answer’s to all your questions on the list, it’s very easy to start and basic technical knowledge is enough to fulfill your work.

      Hope that it help’s you, I’m not an expert but that’s what I have learnt so far working with CYBER GEEK SQUAD as an editor.

      Regards,
      CGS Team

      Reply

Leave a Comment