Problem 602 -- What day is it?

read problem

Tips

A calendar problem that many programmers hate to deal with. Don't touch it if you have no experience in writting any calendar program before.

My approach:

  1. Get Year, Month and Day from input lines. If it is an invalid date, report it.
  2. Determine whether it is in Modern Calendar or Old Calendar.
  3. Determine whether it is a leap year. Note that the leap year rules for Modern and Old Calendar are different.
  4. Find out the weekday by counting how many days has passed since 01 Jan Year 1. If it is in Old Calendar, do some adjustment to the weekday.