4. (20 points) In the Martian calendar, a year consists of 5882 days, and each month has either 100 or 77 days. How many months are there in the Martian calendar?
Answer: 74.

Solution: Let $x$ be the number of months with 100 days, and $y$ be the number of months with 77 days. According to the problem, $100 x + 77 y = 5882$. It is obvious that $y \leqslant 66$, otherwise $x < 0$. Notice that

$$
x \bmod 11 = 100 x \quad \bmod 11 = 5882 \quad \bmod 11 = 8
$$

Thus, $x = 11 k + 8$ for some integer $k$, from which we have

$$
(11 k + 8) \cdot 100 + 77 y = 5882 \Longleftrightarrow 1100 k = 5082 - 77 y = 77(66 - y)
$$

The right side is divisible by 100, but 77 and 100 are coprime. Therefore, the number $66 - y$, which lies between 0 and 65, must be divisible by 100. This is only possible when $y = 66$. Therefore, $x = 0.01 \cdot (5882 - 76 \cdot 66) = 8$ and $x + y = 74$.