Vrijeme: 00:31

Legija loptica | Legion of balls #1

Dane su tri kutije loptica K_1, K_2 i K_3 takve da svaka sadrži točno jednu lopticu. Dozvoljene su sljedeće operacije: \begin{itemize}
\item Biranje jedne neprazne kutije \(K_j\) (\(1 \leq j \leq 2\)), uzimanje jedne loptice iz odabrane kutije i stavljanje dvije loptice u kutiju \(K_{j+1}\);
\item Biranje jedne neprazne kutije \(K_j\) (\(1 \leq j \leq 1\)), uzimanje jedne loptice iz odabrane kutije i zamjena sadržaja kutija \(K_{j+1}\) i \(K_{j+2}\).
\end{itemize} Odredi najveći broj loptica koji je moguće postići u kutiji K_3 gornjim operacijama.
We're given three boxes K_1, K_2 and K_3 such that each of them contains exactly one ball. The following operations are allowed: \begin{itemize}
\item Choosing a non-empty box \(K_j\) (\(1 \leq j \leq 2\)), removing one ball from the selected box and adding two balls to \(K_{j+1}\);
\item Choosing a non-empty box \(K_j\) (\(1 \leq j \leq 1\)), removing one ball from the selected box and swapping the contents of the boxes \(K_{j+1}\) and \(K_{j+2}\).
\end{itemize} Determine the largest obtainable number of balls in K_3 using the operations above.