You are on page 1of 17

JetBrains

Academy
Youth Challenge
February, 2024
Math
Solutions
Contents
Junior League . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
1.1 1.2 1.3 1.4 2.1 2.2 2.3 2.4 2.5 2.6 2.7 2.8
Senior League . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
1.1 1.2 1.3 1.4 2.1 2.2 2.3 2.4 2.5 2.6 2.7 2.8

Junior League
First Stage
𝑥+𝑦+𝑧 𝑥+𝑦+𝑧
Problem 1.1. Real numbers 𝑥, 𝑦, 𝑧 are such that = 2 and = 4. Find the
𝑧+𝑥 𝑦+𝑧
𝑥+𝑦+𝑧
value of the expression .
𝑥+𝑦

Answer: 0.8.

Solution. Let us observe that


𝑦+𝑧 𝑧+𝑥 𝑥+𝑦 2𝑥 + 2𝑦 + 2𝑧
+ + = = 2.
𝑥+𝑦+𝑧 𝑥+𝑦+𝑧 𝑥+𝑦+𝑧 𝑥+𝑦+𝑧

Substituting the two given values, we obtain

1 1 𝑥+𝑦
+ + =2
4 2 𝑥+𝑦+𝑧

from which the answer follows


𝑥+𝑦+𝑧 4
= .
𝑥+𝑦 5
Remark. The values are achieved at, e.g., 𝑥 = 3, 𝑦 = 2, 𝑧 = −1.

Problem 1.2. There are 325 warriors, comprising swordsmen, archers, and spearmen, lined up
in one row. To the left of each swordsman, there is an archer, and to the right of each spearman,
there is an archer. What is the least possible number of archers in the row?

Answer: 109.

Solution. Notice that we can map each swordsman to the archer to the left of him, which means
that the number of swordsmen does not exceed the number of archers. Similarly, the number of
spearmen cannot exceed the number of archers. If follows that the number of archers must be
at least 31 of the total number of warriors. The smallest such integer is 109.
To get an example of such row with 109 archers, denote swordsmen, archers, and spearmen by
letters 𝑋, 𝑌 , and 𝑍, respectively:

𝑌 𝑋 𝑍𝑌
⏝ 𝑋 𝑍𝑌
⏝ 𝑋 … 𝑍𝑌
⏝ 𝑋 𝑍𝑌
⏝ 𝑋 𝑍𝑌

2
Problem 1.3. A collector has several coins, each weighing a whole number of grams. The light-
est coin is found to weigh 50 times less than all the other coins combined. Moreover, the two
lightest coins together weigh 21 times less than all other coins combined. Determine the mini-
mum possible weight, in grams, of the lightest coin.

Answer: 22.

Solution. Denote the total weight of all the coins as 𝑆, the weight of the lightest coin as 𝑎, and
the weight of the second-lightest coin as 𝑏. We have

50𝑎 = 𝑆 − 𝑎 and 21(𝑎 + 𝑏) = 𝑆 − (𝑎 + 𝑏).

Solving for 𝑎 and 𝑎 + 𝑏, respectively, we obtain


1 1
𝑎= 𝑆, 𝑎+𝑏= 𝑆.
51 22
Since the left-hand sides of both equations are integers, 𝑆 must be divisible by both 51 and 22.
Since these are coprime numbers, this implies that 𝑆/51 is divisible by 22, so 22 ∣ 𝑎 and 𝑎 ≥ 22.
Such a weight is achievable if, for example, the collector has three coins with weights of 22 grams,
29 grams, and 1071 grams, respectively.

Problem 1.4. On sides 𝐴𝐵 and 𝐵𝐶 of triangle 𝐴𝐵𝐶, there are 𝐵


points 𝐾 and 𝐿, respectively, such that ∠𝐾𝐿𝐶 = ∠𝐴𝐶𝐿. Find
the length of the segment 𝐾𝐿, given that 𝐴𝐾 = 3, 𝐾𝐵 = 13, and
𝐴𝐶 = 24. 13 𝐿

𝐾
3

𝐴 24 𝐶
Answer: 19.5.

Solution. Let 𝑋 be the point on line 𝐾𝐿 such that 𝐴𝑋 ∥ 𝐵𝐶 (Fig. 1). On the one hand, 𝐴𝑋𝐿𝐶 is
an isosceles trapezoid, which means 𝑋𝐿 = 𝐴𝐶 = 24. On the other hand, 𝑋𝐿 ∶ 𝐾𝐿 = 𝐴𝐵 ∶ 𝐾𝐵 =
16 ∶ 13 due to the intercept theorem. Thus we obtain
13
𝐾𝐿 = 24 ⋅ = 19.5.
16

Second Stage

Problem 2.1. Alice organized the numbers from 1 to 1002 in a 100 × 100 table, ensuring that
each column is in ascending order from top to bottom, and each row is in descending order from
left to right. Determine the maximum value that the sum of the numbers in the corners of the
table can achieve.

3
𝐵

13 𝐿

𝑋 3

𝐴 24 𝐶
Figure 1: for the solution of problem 1.4

Answer: 29704.

Solution. To start, we note that the number 1 must be placed in the top-right corner because it is
the smallest number and cannot be preceded by any other number in its row or followed by any
in its column. Similarly, the largest number, 1002 , can only be placed in the bottom-left corner.
Let us label the numbers in the other two corners as 𝑥 and 𝑦. Considering the arrangement, the
bottom row and the left column together contain 199 numbers, each of which is either equal to
or larger than 𝑥 or 𝑦. This implies that the smaller of 𝑥 and 𝑦 must be at most 1002 − 199 + 1.
Additionally, both 𝑥 and 𝑦 must be smaller than at least 100 other numbers, which means that
the larger of 𝑥 and 𝑦 cannot exceed 1002 − 100 + 1.
Thus, the maximum sum of the corner numbers is:

1 + 1002 + (1002 − 199 + 1) + (1002 − 100 + 1) = 29704.

To achieve such an arrangement, Alice can begin by placing all numbers from 1 to 992 in the
99 × 99 section of the table that includes the top-right corner. For instance, she could use a
right-to-left, top-to-bottom order. Next, she can place the following 99 numbers in the bottom
row, excluding the bottom-left corner. Finally, she can put the remaining 100 numbers in the
left column.

Problem 2.2. In triangle 𝐴𝐵𝐶, points 𝐷 and 𝐸 are chosen on side 𝐵𝐶 such that 𝐴𝐷 = 𝐵𝐶 and
𝐵𝐷 = 𝐶𝐸. Point 𝐹 is the midpoint of 𝐴𝐸. Prove that ∠𝐵𝐹𝐶 = 90∘ .

Solution. Let 𝑀 be the midpoint of segment 𝐵𝐶 (Fig. 2). From the equality 𝐵𝐷 = 𝐶𝐸, it follows
that point 𝑀 is also the midpoint of segment 𝐷𝐸. Consequently, 𝑀𝐹 is the midline in triangle
𝐴𝐸𝐷. Therefore, 2𝑀𝐹 = 𝐴𝐷 = 𝐵𝐶. Thus, in triangle 𝐵𝐹𝐶, the median is equal to half of the
side, which implies ∠𝐵𝐹𝐶 = 90∘ .

4
𝐴

𝐵 𝐷 𝑀 𝐸 𝐶
Figure 2: for the solution of problem 2.2

Problem 2.3. Find all positive integers 𝑛 > 1 for which there exists a positive integer 𝑘 such
that 𝑘𝑛 − (𝑘 − 1)𝑛 is a power of three (with a positive integer exponent).

Answer: 2.

Solution. Notice that if one of the numbers 𝑘 or 𝑘 − 1 is divisible by three, then the other is
not, and the difference cannot turn out to be a power of three. Therefore, these numbers leave
remainders of 2 and 1 when divided by 3, respectively. Then 𝑘 ≡ 2 (mod 3) and 2𝑛 −1 is divisible
by 3. This is only possible if 𝑛 is even. Let 𝑛 = 2𝑚, where 𝑚 ≥ 1 is a positive integer. We can
express the difference as

3𝑡 = 𝑘𝑛 − (𝑘 − 1)𝑛 = 𝑘2𝑚 − (𝑘 − 1)2𝑚 = (𝑘𝑚 − (𝑘 − 1)𝑚 ) (𝑘𝑚 + (𝑘 − 1)𝑚 ) .

If both parentheses are multiples of 3, then their sum, 2𝑘𝑚 , is also a multiple of 3, which is not
possible. Therefore, 𝑘𝑚 − (𝑘 − 1)𝑚 = 1, which is only possible when 𝑚 = 1, and thus 𝑛 = 2.

Problem 2.4. An elf and a dwarf, after defeating a dungeon boss, received a chest containing
100 tokens and 100 bags with gold coins: the first one contains 1 coin, the second contains 2, the
third contains 3, …, the hundredth contains 100 (both players are aware of the contents of each
bag).
The reward is divided as follows. During each turn, the elf chooses any bag from the chest, and
the dwarf then has two options: he can either give the chosen bag to the elf and take one token
from the chest, or he can give up one of his tokens and take the chosen bag for himself. Initially,
both the elf and the dwarf had neither coins nor tokens. What is the maximum number of gold
coins the dwarf can accumulate, assuming optimal play by both players?

Answer: 502 .

Solution. We prove that the desired quantity equals 1 + 3 + 5 + … + 99 = 502 . To do this, it


is sufficient to present a strategy for the dwarf that guarantees him at least the sum of all the

5
odd-numbered bags, and a strategy for the elf that guarantees him at least the sum of all the
even-numbered bags.
Strategy for the dwarf. We divide all the bags into pairs: 1 and 2, 3 and 4, …, 99 and 100. When
the elf chooses the first bag from a pair, the dwarf gives it away, but when the second one is
chosen, he takes it for himself. Given that the dwarf takes every second bag from the pair, he
will always have the necessary token for this action (it can be assumed that he gives away the
token he received for giving away the first bag from the pair). Thus, the dwarf will receive exactly
one bag from each pair, and therefore, no less than 1 + 3 + 5 + … + 99 = 502 gold.
Strategy for the elf. He will simply choose bags in reverse order: 100, 99, …, 1. Let us denote the
bags that the dwarf takes for himself in order as 𝑎1 , 𝑎2 , …, 𝑎𝑘 . We will prove that 𝑎𝑖 ≤ 100−2𝑖+1,
and thus, cumulatively, the dwarf will receive no more than 𝑎1 +𝑎2 +…+𝑎𝑘 ≤ 99+97+…+3+1 =
502 gold.
Consider the 𝑖-th bag taken by the dwarf (i.e., the bag with 𝑎𝑖 gold coins). Since the dwarf was
able to take it, by that time he had received at least 𝑖 tokens, meaning he gave at least 𝑖 bags to
the elf. Thus, by the time the 𝑖-th bag was taken, no less than 𝑖 bags had been given to the elf,
and 𝑖 − 1 bags was taken by the dwarf, and since the elf was choosing bags in reverse order, the
amount of gold coins in this bag is no more than 100 − 𝑖 − (𝑖 − 1) = 100 − 2𝑖 + 1, as required.

Problem 2.5. For any real numbers 𝑥1 , 𝑥2 , … , 𝑥2024 , 𝑦1 , 𝑦2 , … , 𝑦2024 within the range [−1, 1],
prove the following inequality

|𝑥1 𝑥2 … 𝑥2024 − 𝑦1 𝑦2 … 𝑦2024 | ≤ |𝑥1 − 𝑦1 | + |𝑥2 − 𝑦2 | + … + |𝑥2024 − 𝑦2024 |.

Solution. We will prove by induction that if |𝑥1 |, |𝑥2 |, … , |𝑥𝑛 |, |𝑦1 |, |𝑦2 |, … , |𝑦𝑛 | ≤ 1, then

|𝑥1 𝑥2 … 𝑥𝑛 − 𝑦1 𝑦2 … 𝑦𝑛 | ≤ |𝑥1 − 𝑦1 | + |𝑥2 − 𝑦2 | + … + |𝑥𝑛 − 𝑦𝑛 |.

The statement of the problem will follow for 𝑛 = 2024.


For 𝑛 = 1, this is obvious. For 𝑛 = 2 we have

|𝑥1 𝑥2 − 𝑦1 𝑦2 | = |𝑥1 𝑥2 − 𝑥1 𝑦2 + 𝑥1 𝑦2 − 𝑦1 𝑦2 | ≤ |𝑥1 𝑥2 − 𝑥1 𝑦2 | + |𝑥1 𝑦2 − 𝑦1 𝑦2 | (*)


= |𝑥1 | ⋅ |𝑥2 − 𝑦2 | + |𝑦2 | ⋅ |𝑥1 − 𝑦1 | ≤ |𝑥2 − 𝑦2 | + |𝑥1 − 𝑦1 |.

This concludes the base cases. For the inductive step, assume the statement holds for 𝑛 ≥ 2. We
prove it for 𝑛 + 1.

|𝑥1 𝑥2 … 𝑥𝑛+1 − 𝑦1 𝑦2 … 𝑦𝑛+1 | ≤ |𝑥1 𝑥2 … 𝑥𝑛 − 𝑦1 𝑦2 … 𝑦𝑛 | + |𝑥𝑛+1 − 𝑦𝑛+1 |


≤ |𝑥1 − 𝑦1 | + |𝑥2 − 𝑦2 | + … + |𝑥𝑛 − 𝑦𝑛 | + |𝑥𝑛+1 − 𝑦𝑛+1 |.

Here the first inequality applies the base case (*), while the second inequality uses induction
hypothesis.

6
Problem 2.6. Point 𝑂 is the circumcenter of the acute triangle 𝐴𝐵𝐶. A circle with center on
line 𝐴𝑂 passes through point 𝐴 and externally touches the incircle of triangle 𝐴𝐵𝐶 at point 𝐴1 .
Points 𝐵1 and 𝐶1 are defined similarly. Prove that the lines 𝐴𝐴1 , 𝐵𝐵1 and 𝐶𝐶1 have a common
point.

𝐴
𝑂𝐴

𝐴1

𝑂 𝑇
𝐼

𝐵 𝐶

𝐴2

Figure 3: for the solution of problem 2.6

Solution. Let 𝜔 be the incircle of triangle 𝐴𝐵𝐶 with center 𝐼. The circle 𝜔𝐴 with center 𝑂𝐴 ,
located on line 𝐴𝑂, passes through point 𝐴 and touches circle 𝜔 externally at point 𝐴1 (Fig. 3).
Note that the radii of the touching circles drawn to the point of tangency form a single line, which
means that points 𝑂𝐴 , 𝐴1 , and 𝐼 lie on a single line.
Denote the second intersection point of line 𝐴𝐴1 with the circumcircle of triangle 𝐴𝐵𝐶 as 𝐴2 .
The triangles 𝐴𝑂𝐴 𝐴1 and 𝐴𝑂𝐴2 are isosceles and share a common base angle. Therefore, these
triangles are similar, and lines 𝑂𝐴 𝐴1 and 𝑂𝐴2 are parallel.
Let 𝑇 be the point of intersection of lines 𝑂𝐼 and 𝐴𝐴1 . Note that the ratio 𝐼𝑇 ∶ 𝑇𝑂 = 𝐼𝐴1 ∶ 𝑂𝐴2 =
𝑟 ∶ 𝑅, where 𝑟 and 𝑅 are the radii of the incircle and circumcircle of triangle 𝐴𝐵𝐶, respectively.
This allows us to redefine point 𝑇 in a way that is independent of the triangle’s vertex, which
means that the lines 𝐵𝐵1 and 𝐶𝐶1 also pass through it.

Another solution. Define the circumcircle of triangle 𝐴𝐵𝐶 as 𝛺, its incircle as 𝜔, and the circle
that has its center on line 𝐴𝑂, passes through point 𝐴, and externally touches the incircle of
triangle 𝐴𝐵𝐶 as 𝜔𝐴 . Notably, since its center is on 𝐴𝑂, it also internally touches 𝛺 at point 𝐴.
Consider the homothety with a positive scale factor that transforms 𝛺 into 𝜔𝐴 , and the homoth-
ety with a negative scale factor that transforms 𝜔𝐴 into 𝜔. Additionally, consider the homothety

7
with a negative scale factor that directly transforms 𝛺 into 𝜔. The centers of the first two homo-
theties are located at points 𝐴 and 𝐴1 , respectively. Since the third homothety is the composite
of the first two, its center, denoted as 𝑇, must lie on the line 𝐴𝐴1 .
Because 𝑇 is defined in a manner that is invariant with respect to the vertices of the triangle, the
lines 𝐵𝐵1 and 𝐶𝐶1 also pass through point 𝑇.

Problem 2.7. There are 𝑛 cities, among which two-way air travel on griffins is established be-
tween some pairs. It is known that from each city, one can directly (without transfers) reach no
more than 𝑑 other cities. Moreover, it is particularly noted that one can directly travel from the
Capital City to the Outpost City. It is also known that there is a route (possibly with transfers)
between any two cities.
An evil wizard wants to cast a spell that will stop griffin travel between selected pairs of cities so
that for any two cities exactly one route remains between them. Prove that the number of ways
to cast the spell without blocking direct griffin travel between the Capital City and the Outpost
City is at least 𝑑1 of the total number of ways to cast the spell.

Solution. Construct a graph where cities are vertices and direct griffin routes are edges. Notice
that we are interested in the fraction of spanning trees containing edge 𝑒, which connects the
Capital City (𝐶) to the Outpost City (𝑂), within the set of all spanning trees in the resulting
graph. We will refer to trees with edge 𝑒 as interesting.
Consider the Capital City and temporarily close it and all roads leading out of it. Denote the
remaining graph as 𝐺. Each spanning tree in the original graph corresponds to a spanning forest
in graph 𝐺. Consider such a forest 𝐹 and look at the trees it could have come from. Let 𝐴0 , 𝐴1 , …,
𝐴𝑛 be the connected components of forest 𝐹, with 𝑂 ∈ 𝐴0 . Denote by 𝑎0 , 𝑎1 , …, 𝑎𝑛 the number
of edges from 𝑐 to these components. Then, forest 𝐹 results from 𝑎0 ⋅ 𝑎1 ⋅ … ⋅ 𝑎𝑛 trees, 𝑎1 ⋅ … ⋅ 𝑎𝑛
of which contain edge 𝑒. That is, the fraction of interesting trees from which forest 𝐹 is derived,
among all trees from which forest 𝐹 is derived, equals 1/𝑎0 ≥ 1/𝑑. Therefore, the fraction of all
interesting trees among all trees is at least 1/𝑑.

Another solution. Construct a graph in the same way as in the previous solution. Let us denote
the set of all spanning trees that include the edge connecting the Capital City (vertex 𝐶) to the
Outpost City (vertex 𝑂) as 𝒢, and the set of all spanning trees without that edge as ℋ. Our goal
is to demonstrate that |𝒢| ≥ 𝑑1 (|𝒢| + |ℋ|), which is equivalent to |𝒢| ≥ 𝑑−1
1
|ℋ|.
To do this, we introduce a transformation 𝐹 ∶ ℋ → 𝒢. For any given spanning tree 𝐻 from ℋ,
we add the edge 𝐶𝑂 to it. This addition creates a single cycle within the graph, which neces-
sarily includes vertex 𝐶 and, by extension, exactly two edges incident to 𝐶, one of which is 𝐶𝑂.
Removing the other edge incident to 𝐶 eliminates the cycle, resulting in a new spanning tree
𝐹(𝐻) ∈ 𝒢.
It suffices to prove that the transformation 𝐹 maps at most 𝑑 − 1 distinct trees from ℋ to any
specific tree 𝐺 ∈ 𝒢. To reconstruct any original tree 𝐻 for which 𝐹(𝐻) = 𝐺, one must remove the
edge 𝐶𝑂 and reconnect the components by adding one of the other edges incident to 𝐶. Given

8
that 𝐶 is connected by no more than 𝑑 edges, there are at most 𝑑 − 1 alternative edges that can
be used to re-establish the connection.

Problem 2.8. In the set of all positive integers, several numbers are painted red. Prove that it is
possible to paint several more elements of the set red so that the product of all the red numbers
equals the sum of their squares.

Solution. Let us define the product of the elements of a set 𝐴 of positive integers as 𝑃(𝐴) and the
sum of squares of its elements as 𝑄(𝐴). We can reformulate the problem as follows: given a set
𝐴 of positive integers, our objective is to find a superset 𝐵 ⊃ 𝐴 such that 𝑄(𝐵) = 𝑃(𝐵).
We begin by setting 𝐵 = 𝐴 and then will gradually expand 𝐵. First, we ensure that 𝐵 contains at
least three numbers greater than 1; this guarantees that 𝑃(𝐵) will exceed any individual element
of 𝐵 by at least 2, which will be useful later on. Then, we add sufficiently large numbers 𝑥, 2𝑥,
3𝑥 such that 𝑃(𝐵) exceeds 𝑄(𝐵). We can do this because 𝑃(𝐵) ⋅ 6𝑥3 > 𝑄(𝐵) + 14𝑥2 holds for, e.g.,
𝑄(𝐵)+14
any 𝑥 > .
6𝑃(𝐵)

Now, let’s consider 𝐵′ = 𝐵 ∪ {𝑥}, where 𝑥 = 𝑃(𝐵) − 1 (notice that 𝑥 ∉ 𝐵). Since 𝑃(𝐵 ′ ) =
𝑃(𝐵)⋅(𝑃(𝐵)−1) = 𝑃(𝐵)2 −𝑃(𝐵) and 𝑄(𝐵′ ) = 𝑄(𝐵)+𝑃(𝐵)2 −2𝑃(𝐵)+1, we find that 𝑃(𝐵 ′ )−𝑄(𝐵 ′ ) =
𝑃(𝐵) − 𝑄(𝐵) − 1. By adding 𝑥 to the set 𝐵, we effectively reduce the difference between 𝑃(𝐵)
and 𝑄(𝐵) by 1. Iterating this process, we will eventually obtain the desired superset 𝐵 where
𝑄(𝐵) = 𝑃(𝐵).

Another solution. Let us introduce the notations 𝑃(𝐴) and 𝑄(𝐴) in the same way as in the pre-
vious solution. For a given set of positive integers 𝐴, we will find 𝐵 ⊂ 𝐴 such that 𝑄(𝐵) = 𝑃(𝐵).
Initially, we will address a weaker version of the problem, allowing 𝐵 to be a multiset, where
numbers can be included multiple times and contribute accordingly to both the product and the
sum of squares.
Starting with an initial set of positive integers 𝐴, we set 𝐵 = 𝐴 and gradually expand 𝐵. Initially,
we add four instances of the number 2 to 𝐵 (the significance of this will become apparent later).
Then, we continue adding more instances of 2 until 𝑃(𝐵) exceeds 𝑄(𝐵), which is achievable since
each addition of 2 multiplies the product by 2, and the sum of squares only increases by 4 with
each addition.
Next, we augment 𝐵 with 𝑃(𝐵) − 𝑄(𝐵) instances of the number 1. Although this doesn’t alter
the product, it increases the sum of squares by 1 for each added element, achieving 𝑄(𝐵) = 𝑃(𝐵)
and solving the weaker version of the problem.
We proceed by removing all duplicate elements from 𝐵, converting it into a regular set. This is
done iteratively by selecting a duplicated element 𝑥 ∈ 𝐵 and replacing it with another larger
element not yet present in 𝐵, while maintaining the relation 𝑄(𝐵) = 𝑃(𝐵).
Suppose 𝐵 contains two occurrences of a particular element 𝑥. Let 𝐵𝑥 = 𝐵 ⧵ {𝑥} (noting that 𝐵𝑥
still retains at least one other instance of 𝑥). We can express 𝑄(𝐵) = 𝑃(𝐵) as 𝑥2 +𝑄(𝐵𝑥 ) = 𝑥⋅𝑃(𝐵𝑥 ),
a quadratic equation with roots 𝑥 and 𝑥′ = 𝑃(𝐵𝑥 ) − 𝑥 (by Vieta’s formulas). Notably, 𝑥′ > 𝑡 for

9
all 𝑡 ∈ 𝐵𝑥 , as 𝐵𝑥 includes at least two other elements greater than or equal to 2 (which is why
we initially added four instances of 2 to 𝐵), implying 𝑃(𝐵𝑥 ) ≥ 2 ⋅ 2 max(𝑡, 𝑥) > 𝑡 + 𝑥. Hence,
replacing 𝑥 with 𝑥′ in 𝐵 preserves 𝑄(𝐵) = 𝑃(𝐵) while reducing the count of elements in 𝐵 with
duplicates.
Once all duplicates are eliminated from 𝐵, it reverts to a regular set. Importantly, it retains all
original elements of 𝐴 since we never remove an element lacking duplicates.

Senior League
First Stage

Problem 1.1. There are 120 real numbers arranged in a circle such that each number is equal
to the sum of its two neighbors. The numbers are denoted as 𝑎1 , 𝑎2 , … , 𝑎120 in clockwise order.
Given that 𝑎20 = 20 and 𝑎24 = 24, find the value of 𝑎100 .

Answer: −44.

Solution. Let us denote 𝑎 = 𝑎1 , 𝑏 = 𝑎2 . We then have

𝑎3 = 𝑏 − 𝑎, 𝑎4 = −𝑎, 𝑎5 = −𝑏, 𝑎6 = 𝑎 − 𝑏, 𝑎7 = 𝑎, 𝑎8 = 𝑏, 𝑎9 = 𝑏 − 𝑎 …

It is clear that the sequence is cyclic and 𝑎𝑘 = 𝑎𝑘+6 for all 𝑘. Thus 20 = 𝑎20 = 𝑎2 = 𝑏, 24 = 𝑎24 =
𝑎6 = 𝑎−𝑏 and consequently 𝑎 = 24+20 = 44. Finally we obtain that 𝑎100 = 𝑎4 = −𝑎 = −44.

Problem 1.2. The figure shows two squares: 𝐴𝐵𝐶𝐷 and 𝐶𝐾𝐿𝑀. Find the sum of the areas of
these squares, given that 𝐵𝐾 = 11 and 𝐷𝑀 = 7.

𝐾
11 𝐿
𝐵 𝐶

𝐴 𝐷

Answer: 85.

Solution. If we denote 𝐴𝐵 = 𝑥, 𝐾𝐿 = 𝑦, and ∠𝐵𝐶𝐾 = 𝜑, then ∠𝐷𝐶𝑀 = 180∘ − 𝜑. Using the


cosine theorem for the triangles 𝐵𝐶𝐾 and 𝐷𝐶𝑀, we find out that

112 + 72 = 𝐵𝐾 2 + 𝐷𝑀 2 = (𝑥2 + 𝑦2 − 2 cos(𝜑)) + (𝑥2 + 𝑦2 − 2 cos(180∘ − 𝜑)) = 2𝑥2 + 2𝑦2 .

10
Thus, the sum of the areas of the two given squares is equal to 𝑥2 + 𝑦2 = 21 (112 + 72 ) = 85.

Problem 1.3. There are 𝑁 settlements in a country: 2024 villages and several cities. Some pairs
of settlements are connected by direct bus services. To get from any village to any other, you
need to travel through at least two cities. Find the smallest possible value of 𝑁.

Answer: 4048.

Solution. Let us denote the villages as 𝐴1 , 𝐴2 , …, 𝐴2024 . It is obvious that there are no roads
between the villages at all, while from each village there must be a road leading to at least one of
the cities. For each village 𝐴𝑖 (𝑖 = 1, … , 2024), let 𝐵𝑖 denote any city connected by a road to 𝐴𝑖 .
It is clear that all cities 𝐵1 , …, 𝐵2024 are distinct (otherwise, if a city were connected by a road to
two villages, one could travel between the villages by making only one transfer). Thus, there are
at least 2024 cities, and there are at least 2024 + 2024 = 4048 settlements in the country.
Let’s also provide an example of a country with 4048 settlements. Let there be 2024 cities, all
pairwise connected by roads. Let each city also be connected by a road to a unique village. Then,
to travel from any village to any other, it is necessary to make at least two transfers in cities.

Problem 1.4. Consider the function 𝐹(𝑥) = |𝑥| − 1. How many real roots does the equation

𝐹(𝐹( … 𝐹 (𝑥) … )) = 0
⏟⎵⏟⎵⏟
100 times 𝐹

have?

Answer: 101.

Solution. Let us denote the function 𝐹(𝐹(


⏟⎵⏟⎵⏟… 𝐹 (𝑥) … )) as 𝐹 𝑘 (𝑥).
𝑘 times 𝐹

If 𝑥 is not an integer, then 𝐹100 (𝑥) is also not an integer, since 𝐹(𝑥) maps non-integers to non-
integers. If 𝑥 is odd, then 𝐹100 (𝑥) is also odd, since applying 𝐹(𝑥) alters the parity of the number.
Finally, if |𝑥| > 100, then 𝐹100 (𝑥) > 0, since each application of 𝐹(𝑥) decreases the absolute
value of the number by at most 1. Thus, the set of roots is a subset of the set 𝑀 of even numbers
in the range [−100, 100].
On the other hand, we can show that all elements of 𝑀 are roots of our equation. Indeed, for
each 𝑚 ∈ 𝑀, we have

𝐹 |𝑚| (𝑚) = 0, 𝐹 |𝑚|+1 (𝑚) = −1, 𝐹 |𝑚|+2 (𝑚) = 0, …, 𝐹99 (𝑚) = −1, 𝐹100 (𝑚) = 0.

Thus, the roots of the equation are the numbers {−100, −98, … , 98, 100}, and there are exactly
101 of them.

11
Second Stage

Problem 2.1. 17 consecutive positive integers were written on the board. Ralph added them
up, while Felix multiplied them. Could it be that the last 3 digits of Ralph’s result are exactly the
same as the last 3 digits of Felix’s result (and have the same order)?

Answer: yes.

Solution. Let the numbers 992, 993, … , 1008 be written on the board (the middle number be-
tween them is 1000). Then, if Ralph were to add them up, he would get the number 17000, and
if Felix were to multiply them, he would get a number divisible by 1000. Thus, both results end
in 000.
Note. Example here is not unique. However, in all suitable examples, the middle of these 17
numbers is divisible by 1000.

Problem 2.2. Real numbers 𝛼, 𝛽, 𝛾, 𝛿 satisfy the following equation:

sin 𝛼 cos 𝛽 + sin 𝛽 cos 𝛾 + sin 𝛾 cos 𝛿 + sin 𝛿 cos 𝛼 = 2.

What values can the expression cos 2𝛼 + cos 2𝛽 + cos 2𝛾 + cos 2𝛿 attain?

Answer: 0.

Solution. We will use the inequality 𝑥𝑦 ≤ 21 (𝑥2 + 𝑦2 ), and the fact that the equality holds only
when 𝑥 = 𝑦. We have

2 = sin 𝛼 cos 𝛽 + sin 𝛽 cos 𝛾 + sin 𝛾 cos 𝛿 + sin 𝛿 cos 𝛼


2 2 2
sin 𝛼 + cos2 𝛽 sin 𝛽 + cos2 𝛾 sin 𝛾 + cos2 𝛿 sin2 𝛿 + cos2 𝛼
≤ + + +
2 2 2 2
2 2 2 2 2 2
2
sin 𝛼 + cos 𝛼 sin 𝛽 + cos 𝛽 sin 𝛾 + cos 𝛾 sin 𝛿 + cos2 𝛿
= + + +
2 2 2 2
1 1 1 1
= + + + = 2.
2 2 2 2
To attain equality, we need sin 𝛼 = cos 𝛽, sin 𝛽 = cos 𝛾, sin 𝛾 = cos 𝛿, and sin 𝛿 = cos 𝛼. Thus,
we have:

cos 2𝛼 + cos 2𝛽 + cos 2𝛾 + cos 2𝛿


2 2 2 2
= (cos2 𝛼 − sin 𝛼) + (cos2 𝛽 − sin 𝛽) + (cos2 𝛾 − sin 𝛾) + (cos2 𝛿 − sin 𝛿)
2 2 2 2
= (cos2 𝛽 − sin 𝛼) + (cos2 𝛾 − sin 𝛽) + (cos2 𝛿 − sin 𝛾) + (cos2 𝛼 − sin 𝛿)
= 0 + 0 + 0 + 0 = 0.

Problem 2.3. All sides of a convex pentagon 𝐴𝐵𝐶𝐷𝐸 have length 1 and ∠𝐵 + ∠𝐷 = 180∘ . Find
the distance between the vertex 𝐶 and the intersection point of the diagonals 𝐴𝐷 and 𝐵𝐸.

12
𝐶
𝐷

𝐵
𝐹

𝐸 𝐴
Figure 4: for the solution of problem 2.3

Answer: 1.

Solution. Let us denote by 𝐹 the intersection of 𝐴𝐷 and 𝐵𝐸, ∠𝐴 = 𝛼, ∠𝐸 = 𝜀 (fig. 4). Then
𝜀 𝛼
∠𝐹𝐴𝐸 = 90∘ − , ∠𝐹𝐸𝐴 = 90∘ − ,
2 2
and thus,
𝛼+𝜀
∠𝐵𝐹𝐴 = .
2
Moreover,
∠𝐶 = 540∘ − 𝛼 − 𝜀 − ∠𝐵 − ∠𝐷 = 360∘ − 𝛼 − 𝜀 = 360∘ − 2∠𝐵𝐹𝐴.
This means that 𝐶 is the circumcenter of the triangle 𝐵𝐹𝐷 and 𝐶𝐹 = 𝐶𝐵 = 𝐶𝐷 = 1.

Problem 2.4. An elf and a dwarf, after defeating a dungeon boss, received a chest containing
100 tokens and 100 bags with gold coins: the first one contains 1 coin, the second contains 2, the
third contains 3, …, the hundredth contains 100 (both players are aware of the contents of each
bag).
The reward is divided as follows. During each turn, the elf chooses any bag from the chest, and
the dwarf then has two options: he can either give the chosen bag to the elf and take one token
from the chest, or he can give up one of his tokens and take the chosen bag for himself. Initially,
both the elf and the dwarf had neither coins nor tokens. What is the maximum number of gold
coins the dwarf can accumulate, assuming optimal play by both players?

Answer: 502 .

Solution. We prove that the desired quantity equals 1 + 3 + 5 + … + 99 = 502 . To do this, it


is sufficient to present a strategy for the dwarf that guarantees him at least the sum of all the
odd-numbered bags, and a strategy for the elf that guarantees him at least the sum of all the
even-numbered bags.
Strategy for the dwarf. We divide all the bags into pairs: 1 and 2, 3 and 4, …, 99 and 100. When
the elf chooses the first bag from a pair, the dwarf gives it away, but when the second one is

13
chosen, he takes it for himself. Given that the dwarf takes every second bag from the pair, he
will always have the necessary token for this action (it can be assumed that he gives away the
token he received for giving away the first bag from the pair). Thus, the dwarf will receive exactly
one bag from each pair, and therefore, no less than 1 + 3 + 5 + … + 99 = 502 gold.
Strategy for the elf. He will simply choose bags in reverse order: 100, 99, …, 1. Let us denote the
bags that the dwarf takes for himself in order as 𝑎1 , 𝑎2 , …, 𝑎𝑘 . We will prove that 𝑎𝑖 ≤ 100−2𝑖+1,
and thus, cumulatively, the dwarf will receive no more than 𝑎1 +𝑎2 +…+𝑎𝑘 ≤ 99+97+…+3+1 =
502 gold.
Consider the 𝑖-th bag taken by the dwarf (i.e., the bag with 𝑎𝑖 gold coins). Since the dwarf was
able to take it, by that time he had received at least 𝑖 tokens, meaning he gave at least 𝑖 bags to
the elf. Thus, by the time the 𝑖-th bag was taken, no less than 𝑖 bags had been given to the elf,
and 𝑖 − 1 bags was taken by the dwarf, and since the elf was choosing bags in reverse order, the
amount of gold coins in this bag is no more than 100 − 𝑖 − (𝑖 − 1) = 100 − 2𝑖 + 1, as required.

Problem 2.5. Circle 𝜔 lies inside circle 𝛺. Given a convex polygon 𝑃 with sides of equal lengths,
each side intersects both circles at two points. Prove that segments of the polygon’s perimeter
located inside the ring formed by the circles can be divided into two groups in such a way that
the sum of the lengths of the segments in the first group equals the sum of the lengths of the
segments in the second group.

𝐵 𝐷 𝐶 𝐴
𝐹 𝑀 𝑁 𝐸

𝐼
𝑂
Figure 5: for the solution of problem 2.5

Solution. Consider the polygon to have sides of unit length. Let us denote two adjacent vertices
of the polygon as 𝐴 and 𝐵, and examine its side 𝐴𝐵. Assume that 𝛺 intersects it at points 𝐶 and 𝐷,
and 𝜔 intersects it at points 𝐸 and 𝐹, with the points on segment 𝐴𝐵 ordered as 𝐴−𝐶−𝐸−𝐹−𝐷−𝐵.
Furthermore, let 𝑀 be the midpoint of chord 𝐶𝐷 of circle 𝛺, with 𝑂 as the center of this circle.
Let 𝑁 be the midpoint of chord 𝐸𝐹 of circle 𝜔, with 𝐼 as its center (Fig. 5). We have


𝐹𝐷 − 𝐶𝐸 = (𝐹 ⃗
𝐷−𝐶 ⃗ = (𝐴
𝐸) ⋅ 𝐴𝐵 ⃗ 𝐷 − 𝐴𝐹 ⃗
⃗ +𝐴 ⃗ ⋅ 𝐴𝐵
𝐶 − 𝐴𝐸) ⃗
⃗ −𝐴
= 2(𝐴𝑀 ⃗ ⃗ = 2𝑁𝑀
𝑁) ⋅ 𝐴𝐵 ⃗ ⋅ 𝐴𝐵.
⃗ = 2𝐼𝑂
⃗ ⋅ 𝐴𝐵 ⃗

Summing all such expressions for all sides of the polygon results in zero, since the sum of vectors
following the sides equals the zero vector. (For this, endpoints 𝐴 and 𝐵 for each side should
⃗ have the same orientation along the contour of the
be selected in such a way that vectors 𝐴𝐵

14
polygon.) This concludes the solution, as the right-hand side will consist of a sum of perimeter
segments with different signs, allowing positive ones to be grouped together and negative ones
to be grouped separately.

Problem 2.6. Sequences 𝑥𝑛 and 𝑦𝑛 of real numbers are such that 𝑥0 , 𝑦0 > 0 and 𝑥𝑛 = 𝑥𝑛−1 +
3/𝑦𝑛−1 , 𝑦𝑛 = 𝑦𝑛−1 + 3/𝑥𝑛−1 for all positive integer 𝑛. Prove that max{𝑥2024 , 𝑦2024 } ≥ 100.

Solution. Clearly, both sequences contain only positive reals. For all positive integers 𝑛 one can
write
2 2
3 3
𝑥𝑛2 + 𝑦2𝑛 = (𝑥𝑛−1 + ) + (𝑦𝑛−1 + )
𝑦𝑛−1 𝑥𝑛−1
2 2 𝑥𝑛−1 𝑦 𝑛−1 9 9
= 𝑥𝑛−1 + 𝑦𝑛−1 + 6( + )+ 2 + 2
𝑦𝑛−1 𝑥𝑛−1 𝑥𝑛−1 𝑦𝑛−1
2 2
> 𝑥𝑛−1 + 𝑦𝑛−1 + 6 ⋅ 2.

Thus,

2
𝑥2024 + 𝑦22024 > 𝑥2023
2
+ 𝑦22023 + 12 > 𝑥2023
2
+ 𝑦22023 + 12 ⋅ 2 > … > 𝑥02 + 𝑦20 + 12 ⋅ 2024 > 24 288.

2
𝑥2024 2
+𝑦2024 24288
Consequently, max{𝑥2024 , 𝑦2024 } ≥ > > 100.
√ 2 √ 2

Another solution. To start, we will simplify the problem by reducing it to the particular case
where 𝑥𝑛 = 𝑦𝑛 , which is somewhat easier to analyze. We observe that if for all 𝑛 we replace 𝑥𝑛
′ ′
and 𝑦𝑛 with 𝑥𝑛′ = 𝑥𝑛 ⋅𝛼 and 𝑦′𝑛 = 𝑦𝑛 /𝛼 respectively, where 𝛼 > 0, the relations 𝑥𝑛′ = 𝑥𝑛−1 +3/𝑦𝑛−1
′ ′
and 𝑦′𝑛 = 𝑦𝑛−1 +3/𝑥𝑛−1 will still hold. By choosing 𝛼 = √𝑦1 /𝑥1 , we can ensure 𝑥1′ = 𝑦′1 = √𝑥1 𝑦1 .
Since the recurrent relation is symmetrical, this also means 𝑥𝑛′ = 𝑦′𝑛 = √𝑥𝑛 𝑦𝑛 for every 𝑛.

Furthermore, max{𝑥2024 , 𝑦2024 } ≥ √𝑥2024 𝑦2024 , so it suffices to prove 𝑥2024 ≥ 100.
Thus, we’ve reduced the problem to the specific case where 𝑥𝑛 = 𝑦𝑛 . This simplifies the problem
to just one recurrent relation: 𝑥𝑛 = 𝑥𝑛−1 + 3/𝑥𝑛−1 . The rest of the proof is not dissimilar to the
previous solution, but less cumbersome. We will demonstrate 𝑥𝑛 ≥ √6𝑛 by induction. This is
obviously true for 𝑛 = 0, and for all positive 𝑛, we have:

2
𝑥𝑛2 = (𝑥𝑛−1 + 3/𝑥𝑛−1 )2 > 𝑥𝑛−1 + 6 ≥ 6𝑛.

Recognizing that √6 ⋅ 2024 > 100, we establish the desired inequality.


Remark. The recurrent relation 𝑥𝑛 = 𝑥𝑛−1 + 3/𝑥𝑛−1 is a discrete version of the differential
equation 𝑓′ (𝑥) = 3/𝑓(𝑥). This equation admits a solution 𝑓(𝑥) = √6𝑥, which motivates the
inequality 𝑥𝑛 ≥ √6𝑛.

Problem 2.7. In the set of all positive integers, several numbers are painted red. Prove that it is
possible to paint several more elements of the set red so that the product of all the red numbers
equals the sum of their squares.

15
Solution. Let us define the product of the elements of a set 𝐴 of positive integers as 𝑃(𝐴) and the
sum of squares of its elements as 𝑄(𝐴). We can reformulate the problem as follows: given a set
𝐴 of positive integers, our objective is to find a superset 𝐵 ⊃ 𝐴 such that 𝑄(𝐵) = 𝑃(𝐵).
We begin by setting 𝐵 = 𝐴 and then will gradually expand 𝐵. First, we ensure that 𝐵 contains at
least three numbers greater than 1; this guarantees that 𝑃(𝐵) will exceed any individual element
of 𝐵 by at least 2, which will be useful later on. Then, we add sufficiently large numbers 𝑥, 2𝑥,
3𝑥 such that 𝑃(𝐵) exceeds 𝑄(𝐵). We can do this because 𝑃(𝐵) ⋅ 6𝑥3 > 𝑄(𝐵) + 14𝑥2 holds for, e.g.,
𝑄(𝐵)+14
any 𝑥 > .
6𝑃(𝐵)

Now, let’s consider 𝐵′ = 𝐵 ∪ {𝑥}, where 𝑥 = 𝑃(𝐵) − 1 (notice that 𝑥 ∉ 𝐵). Since 𝑃(𝐵 ′ ) =
𝑃(𝐵)⋅(𝑃(𝐵)−1) = 𝑃(𝐵)2 −𝑃(𝐵) and 𝑄(𝐵′ ) = 𝑄(𝐵)+𝑃(𝐵)2 −2𝑃(𝐵)+1, we find that 𝑃(𝐵 ′ )−𝑄(𝐵 ′ ) =
𝑃(𝐵) − 𝑄(𝐵) − 1. By adding 𝑥 to the set 𝐵, we effectively reduce the difference between 𝑃(𝐵)
and 𝑄(𝐵) by 1. Iterating this process, we will eventually obtain the desired superset 𝐵 where
𝑄(𝐵) = 𝑃(𝐵).

Another solution. Let us introduce the notations 𝑃(𝐴) and 𝑄(𝐴) in the same way as in the pre-
vious solution. For a given set of positive integers 𝐴, we will find 𝐵 ⊂ 𝐴 such that 𝑄(𝐵) = 𝑃(𝐵).
Initially, we will address a weaker version of the problem, allowing 𝐵 to be a multiset, where
numbers can be included multiple times and contribute accordingly to both the product and the
sum of squares.
Starting with an initial set of positive integers 𝐴, we set 𝐵 = 𝐴 and gradually expand 𝐵. Initially,
we add four instances of the number 2 to 𝐵 (the significance of this will become apparent later).
Then, we continue adding more instances of 2 until 𝑃(𝐵) exceeds 𝑄(𝐵), which is achievable since
each addition of 2 multiplies the product by 2, and the sum of squares only increases by 4 with
each addition.
Next, we augment 𝐵 with 𝑃(𝐵) − 𝑄(𝐵) instances of the number 1. Although this doesn’t alter
the product, it increases the sum of squares by 1 for each added element, achieving 𝑄(𝐵) = 𝑃(𝐵)
and solving the weaker version of the problem.
We proceed by removing all duplicate elements from 𝐵, converting it into a regular set. This is
done iteratively by selecting a duplicated element 𝑥 ∈ 𝐵 and replacing it with another larger
element not yet present in 𝐵, while maintaining the relation 𝑄(𝐵) = 𝑃(𝐵).
Suppose 𝐵 contains two occurrences of a particular element 𝑥. Let 𝐵𝑥 = 𝐵 ⧵ {𝑥} (noting that 𝐵𝑥
still retains at least one other instance of 𝑥). We can express 𝑄(𝐵) = 𝑃(𝐵) as 𝑥2 +𝑄(𝐵𝑥 ) = 𝑥⋅𝑃(𝐵𝑥 ),
a quadratic equation with roots 𝑥 and 𝑥′ = 𝑃(𝐵𝑥 ) − 𝑥 (by Vieta’s formulas). Notably, 𝑥′ > 𝑡 for
all 𝑡 ∈ 𝐵𝑥 , as 𝐵𝑥 includes at least two other elements greater than or equal to 2 (which is why
we initially added four instances of 2 to 𝐵), implying 𝑃(𝐵𝑥 ) ≥ 2 ⋅ 2 max(𝑡, 𝑥) > 𝑡 + 𝑥. Hence,
replacing 𝑥 with 𝑥′ in 𝐵 preserves 𝑄(𝐵) = 𝑃(𝐵) while reducing the count of elements in 𝐵 with
duplicates.
Once all duplicates are eliminated from 𝐵, it reverts to a regular set. Importantly, it retains all
original elements of 𝐴 since we never remove an element lacking duplicates.

16
Problem 2.8. In a video game, there are 𝑛 cities, and two-way air travel on griffins is established
between certain pairs of them. There is exactly one route (potentially with transfers) between
any two cities. Every griffin flight has a price, which may vary for different pairs of cities but is
independent of the flight direction.
For each pair of cities, we calculated the cost to travel from one to the other (this is the sum of
the prices of flights on the route between these cities). It turned out that these costs include all
integers from 1 to 𝑛(𝑛 − 1)/2. Prove that either 𝑛 or 𝑛 − 2 is a perfect square.

Solution. Let us color the cities in black and white as follows. We start by picking a city, say 𝐴,
and coloring it white. Then, for any other city, let’s call one of them 𝐵, we decide its color based
on the cost to travel from 𝐴 to 𝐵 using the unique route available. If this cost is an even number, 𝐵
is colored white; if it’s odd, 𝐵 is colored black. With this coloring scheme, two neighboring cities
(those directly connected by a griffin flight) will share the same color if the flight cost between
them is even. It easily follows that the travel cost between any two cities will be even if and only
if those cities share the same color.
Now, let us denote the total number of cities colored black as 𝑏 and those colored white as 𝑤.
From this, we can deduce that the total number of pairs of cities with odd travel costs equals 𝑏𝑤.
Recall that 𝑛 = 𝑏 + 𝑤, and consider two cases based on the parity of 𝑛(𝑛 − 1)/2:
When 𝑛(𝑛 − 1)/2 is even: In this scenario, the number of flights with an odd price is precisely
half of the total possible pairs, leading to the equation 𝑛(𝑛 − 1)/4 = 𝑏𝑤. By manipulating this
equation
𝑛2 − 𝑛 = 4𝑏𝑤 ⇒ (𝑏 + 𝑤)2 − 4𝑏𝑤 = 𝑛 ⇒ 𝑛 = (𝑏 − 𝑤)2 .
we find that 𝑛 is a perfect square.
When 𝑛(𝑛 − 1)/2 is odd: Here, the number of flights with an odd price adjusts slightly to ((𝑛2 −
𝑛)/2 + 1)/2 = 𝑏𝑤. Manipulating this equation similarly gives us 𝑛 = (𝑏 − 𝑤)2 + 2. This reveals
that 𝑛 − 2 is a perfect square.

17

You might also like