//日历问题 #include<stdio.h> int type(int i); char week[7][10]={"Saturday","Sunday","Monday","Tuesday","Wednesday","Thursday","Friday"}; int year[2]={365,366}; int month[2][12]={31,28,31,30,31,30,31,31,30,21,30,31,31,29,31,30,31,30,31,31,30,21,30,31}; int main() { int days,dayofweek; int i,j; while(scanf("%d",&days)&&days!=-1) { dayofweek=days%7; for(i=2000;days>=year[type(i)];i++) days-=year[type(i)]; for(j=0;days>=month[type(i)][j];j++) days-=month[type(i)][j]; printf("%d-%02d-%02d %s ",i,j+1,days+1,week[dayofweek]); } return 0; } int type(int i) { if(i%4!=0||(i%100==0&&i%400!=0)) return 0; else return 1; }