/* ID:mingcha1 PROG: friday LANG: C++ */ #include<iostream> #include<string> #include<fstream> using namespace std; ofstream fout ("friday.out"); ifstream fin ("friday.in"); struct Date{ int year,month,day; }; int week(Date a){ int tm=a.month>=3 ?(a.month-2):(a.month+10); int ty=a.month>=3 ?a.year:(a.year-1); return (ty+ty/4-ty/100+ty/400+(int )(2.6*tm-0.2)+a.day)%7; } int main(){ int n,hash[8]; for(int i=0;i<8;++i) hash[i]=0; fin>>n; for(int i=1900;i<1900+n;++i){ for(int j=1;j<13;++j){ Date d; d.year=i,d.month=j,d.day=13; hash[week(d)]++; } } fout<<hash[6]; for(int i=0;i<6;++i) fout<<" "<<hash[i]+1; fout<<endl; }
usaco_friday
最新推荐文章于 2024-10-27 17:37:42 发布