#include <stdio.h>
#include <string.h>
#define ISYEAP(x) (x % 4 == 0 && x % 100 != 0) || (x % 400 == 0) ? 1 : 0
int Day_Of_Month[13][2] = {
0,0,
31,31,
28,29,
31,31,
30,30,
31,31,
30,30,
31,31,
31,31,
30,30,
31,31,
30,30,
31,31};//提前保存每月天数
struct Date
{//定义一个结构体存放日期和计算下一天的日期
int Year;
int Month;
int Day;
void nextDay()
{//计算下一天的日期
Day++;
if (Day > Day_Of_Month[Month][ISYEAP(Year)])
{//天数超过月份最大天数
Day = 1;
Month++;
if (Month > 12)
{
Month = 1;
Year++;
}
}
}
};
char week_corresponding[7][20] ={
"Sunday",
"Monday",
"Tuesday",
"Wednesday",
"Thursday",
"Friday",
"Saturday"};//星期名
char English_Month[13][20] = {
"",
"January",
"February",
"March",
"April",
"May",
"June",
"July",
"Augest",
"September",
"October",
"November",
"December"}; //月名
int buf[3001][13][32];// 定义一个三维数组提前存放每个日期相对初始日期走过的天数
int main()
{
Date tmp;
int count = 0;//计数器统计与初始日期相隔天数
tmp.Day = 1;
tmp.Month = 1;
tmp.Year = 0;//初试日期是0年1月1日
while(tmp.Year != 3001)
{
buf[tmp.Year][tmp.Month][tmp.Day] = count;
tmp.nextDay();
count++;
}//预处理3000年内日期与初始日期相隔天数
int y,d,m;
char M[20];
while(scanf("%d %s %d",&y,M,&d) != EOF)
{
for (m = 1;m < 13;m++)
{
if (strcmp(English_Month[m],M) == 0)
{
break;
}
}//m为月数
int result = ((buf[y][m][d] - buf[2017][1][29] ) % 7 + 7) % 7;
//今天是20170129,星期日。下标为0,计算给定日期的星期下标
printf("%s\n",week_corresponding[result]);
}
return 0;
}