#include<iostream> #include<cstdio> #include<string> using namespace std; int DayTab[2][13] = { {0,31,28,31,30,31,30,31,31,30,31,30,31}, {0,31,29,31,30,31,30,31,31,30,31,30,31}, }; bool IsLeapYear(int year) { return (year % 4 == 0 && year % 100 != 0) || (year % 400 == 0); } string WeekDay[7] = { "Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday" }; string MonthDay[13]={" ","January","February","March","April","May","June","July","August","September", "October","November","December" }; int Month(string str) { int Month = 0; while (MonthDay[Month] != str) { ++Month; } return Month; } int YearTab[2] = { 365,366 }; int main() { int day, year, number, temp_year, day_num, month_num; string month, week_day; while (cin>>day>>month>>year) { month_num = Month(month); number = 0; temp_year = year; while (temp_year < 2001) { number += YearTab[IsLeapYear(temp_year)]; ++temp_year; } while (temp_year > 2001) { --temp_year; number += YearTab[IsLeapYear(temp_year)]; } day_num = 0; for (int i = 0; i < month_num; ++i) { day_num += DayTab[IsLeapYear(year)][i]; } day_num += day; number += (year < 2001) ? (282 - day_num) : (day_num - 282); //以示例日期为基准,2001 11 9为2001年第282天,为tuesday if (year == 2001) { week_day = (day_num<282)? WeekDay[(1 - number) % 7] : WeekDay[(1+number) % 7]; } else { week_day = (year < 2001) ? WeekDay[(1 - number) % 7] : WeekDay[(1+number) % 7]; } cout << week_day << endl; } return 0; }