report VI VI EN
Register | Login
  • HOME
  • PROBLEMSET
  • ROADMAP
  • COMPETITION
  • TOPIC
  • RANKING
  • GUIDE
  • MASHUP
  • ABOUT
  • CONTACT
  • Problem
  • Submit
  • Results
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.
Introduction to Dynamic Programming (Part two)
Sake game
Coins
Coins 2
Game on array
Longest increasing subsequence 2
Convolution
Regular bracket sequence
Faulty addition
Weird bank
Delete operation
Palindromize
Color ribbon
Unique subsequences
Unique subsequences 2
Cow exhibition
Knapsack 3
Compressing array
Regular bracket sequence 2
Maximum path 3
Concating substring
Soil
Stacking boxes
String transformation
Palindromic quadruple
Finding teammates
Topic
Dynamic Programming
Rating 1300
Solution (0) Solution