Week = (d+2*m+3*(m+1)/5+y+y/4-y/100+y/400+1) mod 7;
注:把一月和二月看为是上一年的十三月和十四月
int Date(int y,int m,int d) {
if(m==1||m==2) { //一二月换算
m+=12;
y--;
}
int week = (d + 2*m +3*(m+1)/5 + y + y/4 - y/100 + y/400 + 1)%7;
return week;
}