//土尔逊Torson 编写于2023/3/31 #define _CRT_SECURE_NO_WARNINGS #include <map> #include <cstdio> #include <string> using namespace std; int main() { int mday[13] = { -1,31,28,31,30,31,30,31,31,30,31,30,31 }; string intToWeekday[8] = { "Sunday","Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday" }; map<string, int> monthToint = { {"January",1}, {"February",2}, {"March",3}, {"April",4}, {"May",5}, {"June",6}, {"July",7}, {"August",8}, {"September",9}, {"October",10}, {"November",11}, {"December",12} }; int year, mon, day; char str[100]; string month; bool isBefore; while (scanf("%d%s%d", &day, str, &year) != EOF) { month = str; mon = monthToint[month]; if (year < 2023 || 2023 == year && mon < 3 || 2023 == year && 3 == mon && day < 19) { isBefore = true; } else { isBefore = false; } int begYear, begMon, begDay, endYear, endMon, endDay; if (isBefore) { begYear = year; begMon = mon; begDay = day; endYear = 2023; endMon = 3; endDay = 19; } else { begYear = 2023; begMon = 3; begDay = 19; endYear = year; endMon = mon; endDay = day; } int totalDay = 0; while (true) { if (begYear == endYear && begMon == endMon && begDay == endDay) { break; } ++totalDay; bool isLeap = begYear % 400 == 0 || begYear % 4 == 0 && begYear % 100 != 0; if (isLeap) { mday[2] = 29; } else { mday[2] = 28; } ++begDay; if (begDay > mday[begMon]) { begDay = 1; ++begMon; if (begMon > 12) { begMon = 1; ++begYear; } } } if (isBefore) { //(x + totalDay)%7=7; >== x = (14 - totalDay % 7) % 7; printf("%s\n", intToWeekday[(14 - totalDay % 7) % 7].c_str()); } else { printf("%s\n", intToWeekday[(totalDay + 7) % 7].c_str()); } } //system("pause"); return EXIT_SUCCESS; }