Skip to content / Đến nội dung
ThichHocToan.com

MathNet 2023-part-06 — 191 problems (EN–VI) Question 50

Math Olympiad Vault · MathNet 2023-part-06 — 191 problems (EN–VI)

Question 50

Let $n$ be a positive integer. There are $n$ boxes $B_1, B_2, \dots, B_n$ each of which contains some balls. One can perform the following moves.
Choose positive integers $i$ and $j$ with $1 \le i \le j \le n$, and add exactly one ball to each of the boxes $B_i, B_{i+1}, \dots, B_j$.
For positive integers $x_1, x_2, \dots, x_n$, let $f(x_1, x_2, \dots, x_n)$ be the minimum number of moves required to make the number of balls in each of the boxes divisible by $3$, starting from $x_i$ balls in $B_i$ for each $i = 1, 2, \dots, n$. Find the maximum value of $f(x_1, x_2, \dots, x_n)$.
(If $3|x_i$ for $i = 1, 2, \dots, n$, then $f(x_1, x_2, \dots, x_n) = 0$)