$[$ Theory of algorithms (miscellaneous) $]$ $[$ Extreme principle (miscellaneous) ]

![](https://cdn.mathpix.com/cropped/2024_05_06_b41405b02b6e888d68cag-05.jpg?height=43&width=243&top_left_y=1825&top_left_x=16)

Vasya solved problems for 10 days - at least one problem each day. Each day (except the first), if the weather was cloudy, he solved one more problem than the previous day, and if it was sunny, one less problem. In the first 9 days, Vasya solved 13 problems. What was the weather like on the tenth day?

#
Consider any two consecutive days. Each day at least one problem is solved, but solving exactly one problem on both days is not allowed, so at least three problems are solved over these two days. Thus, over the first 8 days, Vasya solved at least \(4 \cdot 3 = 12\) problems. If he solved at least two problems on the ninth day, the number of problems solved in 9 days would exceed 13. Therefore, exactly one problem was solved on the ninth day. On the tenth day, the weather was cloudy (and Vasya solved two problems), otherwise he would have solved 0 problems on that day, which contradicts the condition.

An example of how this could have happened is: Vasya solved 1, 2, 1, 2, 1, 2, 1, 2, 1, 2 problems over these 10 days. It is not difficult to prove that this example is unique. Indeed, the proof that Vasya solved exactly one problem on the ninth day applies to any odd day.

## Answer

Cloudy.

## Problem