1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52
|
#include <cstdio> #include <cstring> #include <algorithm> #include <string> #include <map> using namespace std;
typedef long long LL; const int maxn = 10; const int md[] = {0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}; int ans[10];
inline bool isLeap(int y) { return y % 400 == 0 || (y % 4 == 0 && y % 100 != 0); }
inline void NexT(int& c) { ++c; if (c == 8) { c = 1; } }
int main() { freopen("friday.in", "r", stdin); freopen("friday.out", "w", stdout); int n, cur = 1; scanf("%d", &n); for (int i = 0; i < n; ++i) { int y = 1900 + i; for (int j = 1; j <= 12; ++j) { for (int k = 1; k <= md[j]; ++k) { if (k == 13) { ++ans[cur]; } NexT(cur); } if (j == 2 && isLeap(y)) { NexT(cur); } } } for (int i = 1; i <= 7; ++i) { printf("%d%c", ans[(i + 4) % 7 + 1], i == 7 ? '\n' : ' '); } return 0; }
|