Klepitsyn V.A.  In the city of Flat, there is not a single tower. To develop tourism, the residents of the city are going to build several towers with a total height of 30 floors. Inspector Vysotnikov, climbing each tower, counts the number of shorter towers, and then adds up the resulting values. After that, the inspector recommends the city more strongly, the greater the resulting value is. How many and of what height should the residents build the towers to get the best possible recommendation?
Let some tower have a height $h>2$. We will remove the top floor from it, turning it into a new tower of height 1. How will this change the inspector's sum? From the shortened tower, towers of height $h-1$ are no longer visible. However, since $h>2$, from all these towers (including the shortened one), the new tower is now visible. Therefore, the inspector's total sum increases. Consequently, building towers taller than 2 is pointless.

It remains to study the case where all towers have a height of 1 or 2. If there are $x$ towers of height 1 and $y$ towers of height 2 ( $x+2 y=30$ ), then the inspector's sum is

$x y=(30-2 y) y=2 y(15-y)=2\left(7.5^{2}-(y-7.5)^{2}\right)$.

For integer $y$, this expression takes its maximum value at $y=7$ and $y=8$, and equals 112.

## Answer

Either 16 one-story and 7 two-story towers, or 14 one-story and 8 two-story towers.

Author: Shapovalov A.V.

On the table, there are 9 apples, forming 10 rows of 3 apples each (see fig.).

![](https://cdn.mathpix.com/cropped/2024_05_06_88363d92b48074f4f115g-30.jpg?height=337&width=345&top_left_y=229&top_left_x=868)

It is known that the weights of nine rows are the same, while the weight of the tenth row differs from them. There are electronic scales, on which for one ruble you can find out the weight of any group of apples. What is the minimum number of rubles you need to pay to find out which row's weight differs?

## Solution

Before spending money, let's think.

Let $l_{1}, l_{2}, l_{3}$ be the weights of the three bold (see fig. a) diagonal rows, and $v_{1}, v_{2}, v_{3}$ be the weights of the three vertical rows. Then $l_{1}+l_{2}+l_{3}=v_{1}+v_{2}+v_{3}$: both are simply the sum of the weights of all nine apples. But at least five of these six quantities are equal to the same value $t$, so all six are equal.

![](https://cdn.mathpix.com/cropped/2024_05_06_88363d92b48074f4f115g-30.jpg?height=403&width=412&top_left_y=1056&top_left_x=823)

Similarly, we obtain that the weights of the other three diagonal rows are also equal to $t$. We have found nine rows whose weights are equal. Therefore, the weight of the remaining row, the horizontal one, differs.

## Answer

0 rubles.