import java.io.*;
class TheDay
{
public static void main(String[] args)
{
//System.out.println("Hello World!");
DataInputStream dis;
int year;
int month;
int day;
try
{
dis=new DataInputStream(System.in);
System.out.print("Year:");
year=Integer.parseInt(dis.readLine());
System.out.print("Month:");
month=Integer.parseInt(dis.readLine());
System.out.print("Day:");
day=Integer.parseInt(dis.readLine());
System.out.print("这天是:");
System.out.println(WeekDay.nameOfWeekday(year,month,day));
}
catch(IOException e)
{
System.out.println("输入日期错误!!!!!");
}
}
}
class WeekDay
{
/*public static int weekdayOfFirstDayOfTear(int year)
{
int tem=year-1;
return(tem+tem/4-tem/100+tem/400)%7;
}*/
public static boolean isRunNian(int year)
{
if (year%4==0&&year%100!=0)
return true;
else if(year%400==0)
return true;
else
return false;
}
public static int weekDay(int year,int month,int day)
{
//int firstDay=weekdayOfFirstDayOfTear(year);
int tem=year-1;
int monthDays[]=new int[12];
for(int i=0;i<7;i++)
{
if(i%2==0)
monthDays[i]=31;
else
monthDays[i]=30;
}
if(isRunNian(year))
monthDays[1]=29;
else
monthDays[1]=28;
for(int i=7;i<12;i++)
{
if(i%2==0)
monthDays[i]=30;
else
monthDays[i]=31;
}
int total=day;
for(int i=0;i<month-1;i++)
total+=monthDays[i];
return (total+tem+(int)(tem/4)-(int)(tem/100)+(int)(tem/400))%7;
}
public static String nameOfWeekday(int year,int month,int day)
{
int weekday=weekDay(year,month,day);
switch(weekday)
{
case 0:
return "Sunday";
case 1:
return "Monday";
case 2:
return "Tuesday";
case 3:
return "Wendsday";
case 4:
return "Thursday";
case 5:
return "Friday";
case 6:
return "Saturday";
default:
return "Error";
}
}
};