打表打表QAQ
#include<iostream>
#include<algorithm>
using namespace std;
const int N = 10;
int month[2][13] = {
{-1,31,28,31,30,31,30,31,31,30,31,30,31},
{-1,31,29,31,30,31,30,31,31,30,31,30,31}
};
int ans[N];
int cnt = 0;
int main() {
int n;
cin >> n;
for (int i = 1900;i <= 1900 + n - 1;i++) {
bool flag = i % 400 == 0 || (i % 4 == 0 && i % 100 != 0);
for (int j = 1;j <= 12;j++) {
ans[(cnt + 13) % 7]++;
cnt += month[flag][j];
}
}
int k = 0;
while(k < 7) {
cout << ans[(k + 6) % 7] << ' ';
k++;
}
return 0;
}