Start: Jun, 26, 2019 08:30:00
2019年度暑期短学期第一天
End: Jun, 26, 2019 11:30:00
Time elapsed:
Time remaining:

Problem_ID: C
Result: Accepted
Time: 6ms
Memory: 1092kB
Author: 2018212212050
In contest: 1273

#include <stdio.h>

int main() {
	int y,m,d,w,c;
	while(scanf("%d %d %d",&y,&m,&d)!=EOF)
	{
		c=y/100;
		y=y%100;
		if(m<3)
		{
			m=m+12;
			y=y-1;
		}
		w=y+(y/4)+(c/4)-2*c+(26*(m+1)/10)+d-1+700000;
		w%=7; 
		if(w==1)
		{
			printf("Monday\n");
		}
		else if(w==2){
			printf("Tuesday\n");
		}
		else if(w==3){
			printf("Wednesday\n");
		}                                                            
		else if(w==4)
		{
			printf("Thursday\n");
		}
		else if(w==5){
			printf("Friday\n");
		}
		else if(w==6)
		{
			printf("Saturday\n");
		}
		else if(w==0)
		{
			printf("Sunday\n");
		}
	}	
	return 0;
}