|Online Judge||Problem Set||Authors||Online Contests||User|
A year calendar is printed using the monospace font according to the following rules:
Note that January 1st, 1900 was Monday. Also note that the year is a leap year if its number is divisible by 4 and not divisible by 100, or divisible by 400. For example, a part of the printed calendar from October to December 2002 looks like this:
The calendar was printed and then burned, with only a small rectangular piece left. Your program must determine to which of years from 1900 to 2100 this piece could belong.
The first line of the input file contains integer numbers N and M - the sizes of the piece, separated by spaces. The following M lines contain N characters each - the piece of calendar. 2 <= N, M <= 10
Output file must contain an ordered list of year numbers, one year per line. If given piece could not belong to any calendar, output must contain a single integer 0 (zero).
4 4 1..8 .... JUNE 1..8
1903 1914 1925 1931 1942 1953 1959 1970 1981 1987 1998 2009 2015 2026 2037 2043 2054 2065 2071 2082 2093 2099
Northeastern Europe 2002, Far-Eastern Subregion
[Submit] [Go Back] [Status] [Discuss]
Home Page Go Back To top
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator