标签:
/*ID: awsd1231PROG: fridayLANG: C++*/#include<iostream>#include<cstdio>usingnamespace std;constint monthDay[12]={31,0,31,30,31,30,31,31,30,31,30,31};int main(){ freopen("friday.in","r", stdin); freopen("friday.out","w", stdout);int year =1900;int today =6;int week[8]={0}; week[6]++;int n; cin >> n;for(int i =0; i != n;++i){for(int j =0; j !=12;++j){if(j ==1)if((year+i)%4==0&&(year+i)%100!=0||(year+i)%400==0) today =(today +29)%7;else today =(today +28)%7;else today =(today + monthDay[j])%7; week[today]++;// cout << j+2 << "月:" << today << endl;}} week[today]--; cout << week[6]<<" ";for(int i =0; i !=5; i++) cout << week[i]<<" "; cout << week[5]; cout << endl;return0;}标签:
原文地址:http://www.cnblogs.com/liangyongrui/p/4541850.html