Weird bank - MarisaOJ: Marisa Online Judge

Weird bank

Time limit: 1000 ms
Memory limit: 256 MB
At the bank, you can exchange a coin of value $x$ for three coins of values $\lfloor \frac{x}{2} \rfloor$, $\lfloor \frac{x}{3} \rfloor$, and $\lfloor \frac{x}{4} \rfloor$. For a real number $y$, the notation $\lfloor y \rfloor$ represents the largest integer not greater than $y$. You have $T$ coins. For each coin, if exchanged optimally, what is the maximum amount of money you can get? ### Input - The first line contains an integer $T$. - The next $T$ lines each contain an integer $x$, representing the value of the coin you have. ### Output - For each coin, output an integer representing the maximum money you can obtain from that coin. ### Constraints - $1 \le T \le 10$ - $1 \le x \le 10^9$ ### Example Input: ``` 2 12 2 ``` Output: ``` 13 2 ``` Explanation: - Coin of value $12$: Exchanging the coin of value $12$ will give you coins of values $6$, $4$, and $3$. Further exchanging any of these new coins will not yield additional profit. - Coin of value $2$: Exchanging the coin of value $2$ will give you coins of values $1$, $0$, and $0$, so you should not exchange it.