蔡勒公式
#include<iostream>
using namespace std;
//蔡勒公式 给定年月日 算出此天是星期几
int weekday(int year,int month,int day) {
if(month == 1 || month == 2){
month += 12;
year--;
}
int c = year / 100;
int y = year % 100;
int m = month;
int d = day;
int w = c / 4 - 2 *c + y + y / 4 + 26*(m+1) / 10 + d - 1;
if(w < 0)
return (w + (-w / 7 + 1) * 7) % 7;
return w % 7;
}
int main(){
cout<<weekday(2020,2,1)<<endl;
return 0;
}