Result: Accepted
Time: 5ms
Memory: 1092kB
#include<stdio.h>
int main()
{
int t,i,year,month,day,y,m,d,w;
int day1[2][13]={{0,31,28,31,30,31,30,31,31,30,31,30,31},
{0,31,29,31,30,31,30,31,31,30,31,30,31}};
char a[7][10]={{"Sunday"},{"Monday"},{"Tuesday"},{"Wednesday"},{"Thursday"},{"Friday"},{"Saturday"}};
while(scanf("%d%d%d",&year,&month,&day)!=EOF)
{
y=year;
m=month;
d=day;
if(m<3)
{
m+=12;
y--;
}
w=((d+1+2*m+3*(m+1)/5)+y+y/4-y/100+y/400)%7;
/*if(year%4==0&&year%100!=0||year%400==0)
{
for(i=1;i<month;i++)
day+=day1[1][i];
}
else
{
for(i=1;i<month;i++)
day+=day1[0][i];
}*/
printf("%s\n",a[w]);
}
}