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: 7ms
Memory: 1716kB
Author: 2018212212163
In contest: 1273

#include<stdio.h>
#include<math.h>
#include<string.h>
#include<stdlib.h>
#include<iostream>
#include<algorithm>
int main()
{
	int y,m,d,ans,w;
	while(~scanf("%d %d %d",&y,&m,&d)){
		if(m==1||m==2){
			m+=12,y--;
			w=((d+2*m+3*(m+1)/5+y+y/4-y/100+y/400))%7+1;
		}else{
			w=((d+2*m+3*(m+1)/5+y+y/4-y/100+y/400))%7+1;
		}
		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==7){
			printf("Sunday\n");	
		}
	}
}