View Code
#include <stdio.h>
int main()
{
int year,month,day;
while(scanf("%d%d%d",&year,&month,&day)!=EOF)
{
if ( month < 3 )
{
year -= 1;
month += 12;
}
char b[7][10] = {"sunday","monday","tuesday","wednesday","thursday","friday","saturday"};
int c = year/100, y = year - 100 * c;
int w = c/4 - 2*c +y+y/4 +(26 * (month + 1)/10 ) + day - 1;
w = (w % 7+7)%7;//注意不然如2003 3 1会错,w可能为-22
printf("%s\n",b[w]);
}
}