Given an $$$a_0$$$, we define $$$a_{n+1} = \left \lfloor{\frac{a_n + a_n'}{2}}\right \rfloor$$$ where $$$a'$$$ is the number obtained by reversing the decimal representation of $$$a$$$ (for example, $$$1045' = 5401$$$) and $$$\left \lfloor{a}\right \rfloor$$$ is the largest integer less than or equal to $$$a$$$. Given $$$a_0$$$, what is the first $$$a_n$$$ that is a palindrome? (A number is a palindrome if its decimal representation reads the same forwards and backwards, that is, $$$a_n = a_n'$$$). If no $$$a_n$$$ is a palindrome, write "Que complicado!".
The first line indicates an integer $$$t$$$, the number of cases. In each of the following $$$t$$$ lines, there is an integer, the $$$a_0$$$ for the corresponding case.
For each case, write the first $$$a_n$$$ that is a palindrome, or if there is none, write "Que complicado!" without the quotes.
10 points: $$$t = 1000$$$ and $$$ 0 \leq a_0 \lt 1000$$$
30 points: $$$t = 10000$$$ and $$$0 \leq a_0 \lt 100000$$$
60 points: $$$t = 10000$$$ and $$$0 \leq a_0 \lt 1000000000$$$
4 8 45 245 10196087
8 44 393 Que complicado!
| Name |
|---|


