Zeller#
https://baike.baidu.com/item/%E8%94%A1%E5%8B%92%E5%85%AC%E5%BC%8F/10491767?fr=aladdin
蔡勒(Zeller)公式,是一个计算星期的公式,随便给一个日期,就能用这个公式推算出是星期几。
注意点:1,2月要当成上一年的13,14月计算
而一般的,c,y可以由year推之
如果日期是在1582年10月4日或之前,则所得答案还要+3
#include<iostream>
using namespace std;
string b[7]={"sunday","monday","tuesday","wednesday","thursday","friday","saturday"};
int main()
{
int year,month,day;
while(cin>>year>>month>>day)
{
if(month<3)
{
year-=1;
month+=12;
}
int c=year/100,y=year-100*c;
int w=+y+(y/4)+(c/4)-2*c+(13*(month+1)/5)+day-1;
w=(w%7+7)%7;
cout<<b[w]<<endl;
}
return 0;
}