0119. Day of Week
Input file name: | dayofw.in |
Output file name: | dayofw.out |
Time limit: | 1 s |
Memory limit: | 64 megabytes |
We now use the Gregorian style of dating in Russia. The leap years are years with number divisible by 4 but not divisible by 100, or divisible by 400.
For example, years 2004, 2180 and 2400 are leap. Years 2001, 2181 and 2300 are not leap.
You task is to write a program which will compute the day of week corresponding to a given date in the nearest past or in the future using today's agreement about dating.
Input file
The input file consists of one or more test cases. Each test case is located in a single line. This line contains the day number d, month name M and year number y (1980 ≤ y ≤ 10300). The month name is the corresponding English name starting from the capital letter. Some extra spaces and/or line feeds may follow the last case.
Output file
For each test case, output a single line with the English name of the day of week corresponding to the date, statring from the capital letter. All other letters must be in lower case.
Examples:
dayofw.in | dayofw.out |
---|---|
9 October 2001 14 October 2001 | Tuesday Sunday |
Source: Petrozavodsk Summer 2003. Blitz Kontest, Monday, August 25
Author: Andrew Lopatin, Nick Durov
Discuss Submit a solution
Printable version