Bovine Birthday
Time limit1sMemory limit1024 MB
Given a date from 1800 or later, print its day of the week, using January 1, 1900 as a Monday and the Gregorian leap year rules.
- Level
Easy2 of 10
- Topics
- Implementation, Math
- Solved
- No attempts yet
Problem
Bessie asked her friend what day of the week she was born on. She knew she was born on May 25, 2003, but did not know what day it was. Write a program to help. No cow was born earlier than the year 1800.
Facts to know:
- January 1, 1900 was a Monday.
- The lengths of the months are:
Jan 31 May 31 Sep 30
Feb 28 or 29 Jun 30 Oct 31
Mar 31 Jul 31 Nov 30
Apr 30 Aug 31 Dec 31
- Every year evenly divisible by 4 is a leap year. For example, 1992 = 4 × 498, so 1992 is a leap year, but 1990 is not.
- The rule above does not hold for century years. Century years divisible by 400 are leap years, and all other century years are not. Thus 1700, 1800, 1900, and 2100 are not leap years, but 2000 is.
Input
- Line 1: Three space-separated integers that represent the year, month (range 1 to 12), and day of a date.
Output
- Line 1: A single word that is the day of the week of the specified date, from the lowercase list: monday, tuesday, wednesday, thursday, friday, saturday, sunday.
Hint
May 2003
Su Mo Tu We Th Fr Sa
1 2 3
4 5 6 7 8 9 10
11 12 13 14 15 16 17
18 19 20 21 22 23 24
25 26 27 28 29 30 31