Year 2007
InterviewTime limit2sMemory limit128 MB
Given a month and day in 2007, compute and print the corresponding day of the week starting from Monday, Jan 1.
- Level
Easy2 of 10
- Topics
- Math, Implementation
- Solved
- No attempts yet
Problem
Today is Monday, January 1, 2007. Given a date in 2007, write a program that determines the day of the week for that date.
Input
The first line contains a month x and a day y, separated by a space. 1 <= x <= 12 and 1 <= y <= 31.
The number of days in each month of 2007 is as follows.
- January, March, May, July, August, October, December: 31 days
- April, June, September, November: 30 days
- February: 28 days
The input date is guaranteed to be a valid date in 2007.
Output
Print the day of the week for the given date as one of SUN, MON, TUE, WED, THU, FRI, or SAT.