这个没有什么好讲的。
1 /*
2 ID : 31440461
3 PROG : friday
4 LANG : C++
5 */
6 #include <iostream>
7 #include <fstream>
8 const int a[12] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
9 int mark[7];
10 using namespace std;
11 int n, now, month;
12 int main(void)
13 {
14 ifstream fin ("friday.in");
15 ofstream fout ("friday.out");
16 now = 13; mark[6]++;
17 fin >> n;
18 for (int i = 1; i <= n; i++)
19 for (int j = 0; j < 12; j++)
20 {
21 now += a[j];
22 if ( ( (1899 + i) % 400 == 0 || ( (1899 + i) % 4 == 0 && (1899 + i) % 100 != 0 ) ) && j == 1)
23 now++;
24 now %= 7;
25 if (i != n || j != 11)
26 mark[now]++;
27 }
28 fout << mark[6] << " ";
29 for (int i = 0; i < 5; i ++)
30 fout << mark[i] << " ";
31 fout << mark[5] << endl;
32 }
33