#P1202. [USACO1.1] 黑色星期五 Friday the Thirteenth

[USACO1.1] 黑色星期五 Friday the Thirteenth

Description

It is Friday the 1313th again. Does the 1313th fall on Friday less often than on other days?

To answer this question, write a program that counts, for each month, how many times the 1313th falls on each day of the week. Given a period of nn years, compute the counts for dates from January 11, 19001900 to December 3131, 1900+n11900 + n - 1.

Here are some things you need to know:

  1. January 11, 19001900 was a Monday.
  2. Months 44, 66, 99 and 1111 have 3030 days; all other months except month 22 have 3131 days. In a leap year, February has 2929 days; in a common year, February has 2828 days.
  3. A year divisible by 44 is a leap year (1992=4×4981992 = 4 \times 498, so 19921992 is a leap year, but 19901990 is not).
  4. The above rule does not apply to century years. A century year divisible by 400400 is a leap year; otherwise, it is a common year. Thus, 17001700, 18001800, 19001900, and 21002100 are common years, while 20002000 is a leap year.

Input Format

A single positive integer nn.

Output Format

Output, in order, the counts of Saturday, Sunday, Monday, Tuesday, Wednesday, Thursday, and Friday on which the 1313th occurs. Print them on one line, separated by spaces.

20

36 33 34 33 35 35 34

Hint

Constraints
For 100%100\% of the testdata, 1n4001 \le n \le 400.

Translation from NOCOW.
USACO Training Section 1.11.1.

Translated by ChatGPT 5