#include <cstdio> #include <iostream> #include<string> #include<map> using namespace std; //这题真的挺费事的 //我自己随便找了一个久远的星期一的一天,然后计算两个日期之间的天数差即可 int solve(int year, int month, int day, int year2, int month2, int day2) { int data[13] = {0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}; if ((year % 100 != 0 && year % 4 == 0) || year % 400 == 0) data[2] = 29; int res = 0; int i = 0; res -= day; while (year != year2) { for (i = month; i <= 12; i++) { res += data[i]; } if (year != year2) { month = 1; year += 1; //在改变年份的时候记得修改2月的日期!!!!! if ((year % 100 != 0 && year % 4 == 0) || year % 400 == 0) data[2] = 29; else data[2] = 28; } } if (year == year2) { while (month < month2) { res += data[month]; month++; } res += (day2 + 1); } return res; // printf("%d-%02d-%02d\n", year, i, addDay); } int main() { int num1, num2; map<string, int> m; map<int, string> week; m["January"] = 1; m["February"] = 2; m["March"] = 3; m["April"] = 4; m["May"] = 5; m["June"] = 6; m["July"] = 7; m["August"] = 8; m["September"] = 9; m["October"] = 10; m["November"] = 11; m["December"] = 12; week[1] = "Monday"; week[2] = "Tuesday"; week[3] = "Wednesday"; week[4] = "Thursday"; week[5] = "Friday"; week[6] = "Saturday"; week[0] = "Sunday";//星期天尤其记得是0序号 int day, year; string month; while (cin >> day >> month >> year) { int m1 = m[month]; int days = solve( 1969, 12, 29, year, m1, day); days %= 7; cout << week[days] << endl; } } // 64 位输出请用 printf("%lld")