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: 5ms
Memory: 1092kB
Author: 2018212212054
In contest: 1273

#include<stdio.h>
#include<math.h>
int dayOfWeek(int year,int month,int day)
{   static int _month[12]={31,0,31,30,31,30,31,31,
    30,31,30,31};
int i,S,C=0;
    if(year%4==0 && year%100!=0 || year%400==0)
       _month[1]=29;
    else _month[1]=28;
    for(i=0;i<month-1;++i)
      C+=_month[i];
    C+=day;
    S=year-1+(year-1)/4-(year-1)/100+(year-1)/400+C;
    return S%7;
}
int main(){
	int a,b,c,s;
	while(scanf("%d %d %d",&a,&b,&c)!=EOF){
		s=dayOfWeek(a,b,c);
		switch(s){
		case 0:printf("Sunday\n");
				break;
		case 1:printf("Monday\n");
				break;
		case 2:printf("Tuesday\n");
				break;
		case 3:printf("Wednesday\n");
				break;
		case 4:printf("Thursday\n");
				break;
		case 5:printf("Friday\n");
				break;
		case 6:printf("Saturday\n");
				break;
		}
	}
	return 0;
}