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: 2018212212074
In contest: 1273

#include <stdio.h>
const char * getWeekdayByYearday(int iY, int iM, int iD) 
{
    int iWeekDay = -1; 
    if (1 == iM || 2 == iM) 
    {   
        iM += 12; 
        iY--;
    }   
    iWeekDay = (iD + 1 + 2 * iM + 3 * (iM + 1) / 5 + iY + iY / 4 - iY / 100 + iY / 400) % 7;
    switch(iWeekDay)
    {   
        case 0 : return "Sunday"; 
	break;
        case 1 : return "Monday";
	break;
        case 2 : return "Tuesday"; 
	break;
        case 3 : return "Wednesday"; 
	break;
        case 4 : return "Thursday"; 
	break;
        case 5 : return "Friday"; 
	break;                                                             
        case 6 : return "Saturday"; 
	break;
        default : return NULL;
	 break;
    }   
    return NULL;
}
int main()
{
    int y,m,d;
    char ch='1';
    while( scanf("%d %d %d",&y,&m,&d)!=EOF)
    { 
        const char * p = getWeekdayByYearday(y, m, d);
        printf("%s\n", p);
        ch = getchar();
    }
}