### folcotandiono's blog

By folcotandiono, history, 7 months ago, ,

https://codeforces.com/gym/101911/problem/C . For each number in the array, I will merge each number from the array until it can't be merged, and then for each number in the array after it merged, I will multiply and then search for the number in the array, if it not found and the number is bigger than the maximum value on the array, then it will be no answer, I got wrong answer..

• 0

 » 7 months ago, # |   0 Auto comment: topic has been updated by folcotandiono (previous revision, new revision, compare).
 » 7 months ago, # | ← Rev. 2 →   +1 i dont really understood your aproach... but you can just always take the two smallest numbers $x$ and $y$, if $x = y$ insert $2x$ else insert $2x$ and $y$ and increase the result by one. if this terminates you definately found the correct result. If there is no solution this programm will not terminate. The non mathematical solution to handle this is to stop if $x$ becomes too big. The mathematical solution is to check if a solution does exist (all values have to be of the form $2^x$ min)