Day of the week P79567


Statement
 

pdf   zip

thehtml

Given a date, can you compute its corresponding day of the week? For instance, the day of the week of de date 2 October 2024 is Wednesday.

Remember that the days of the week are Monday, Tuesday, Wednesday, Thursday, Friday, Saturday, and Sunday. Also, common years have 365 days. At most once every four years, we have a leap year of 366 days. 2024 is a leap year.

These are the months and their lenghts:

  • January: 31 days
  • February: 28 days in common years and 29 days in leap years
  • March: 31 days
  • April: 30 days
  • May: 31 days
  • June: 30 days
  • July: 31 days
  • August: 31 days
  • September: 30 days
  • October: 31 days
  • November: 30 days
  • December: 31 days

Input

Input consists of several dates, all in the format day month year. All years are between 2021 and 2027, and all dates are correct.

Output

For every given date, print its day of the week.

Public test cases
  • Input

    2 October 2024
    31 December 2027
    29 February 2024
    

    Output

    Wednesday
    Friday
    Thursday
    
  • Information
    Author
    Salvador Roura
    Language
    English
    Official solutions
    C++
    User solutions
    C++