Result: Accepted
Time: 5ms
Memory: 1092kB
#include<stdio.h>
int main()
{
int year,month,day;
while(scanf("%d%d%d",&year,&month,&day)!=EOF)
{
int iWeekDay=-1;
if(1==month||2==month)
{
month+=12;
year--;
}
iWeekDay=(day+1+2*month+3*(month+1)/5+year+year/4-year/100+year/400)%7;
if(iWeekDay==0)
{
printf("Sunday\n");
}
if(iWeekDay==1)
{
printf("Monday\n");
}
if(iWeekDay==2)
{
printf("Tuesday\n");
}
if(iWeekDay==3)
{
printf("Wednesday\n");
}
if(iWeekDay==4)
{
printf("Thursday\n");
}
if(iWeekDay==5)
{
printf("Friday\n");
}
if(iWeekDay==6)
{
printf("Saturday\n");
}
}
}