If you finished the puzzle “Gravity Centrifuge Tuning” (https://www.codingame.com/ide/puzzle/gravity-centrifuge-tuning)
would you mind explaining me the calcul method since i dont get it !!
From what i understood the “tumbles potential” of each bit is:
100 -> 1+2=3
1000 -> 2+3=5
100000 -> 8+5=13
and so on.
So, for the input 9, i guess that the output should be 9=8+1(1001) but the testcase expect me to answer 21(10101) ??!!
I am a bit lost …
Thanks for your help !!
Have a look at the name of that testcase
I don’t get the point with this ‘octal’ conversion.
And the following extra rule just add more to the confusion:
Damaged Gravity Centrifuges
The Gravity Centrifuge you’ve got access to has a cooling issue that hasn’t been fixed yet. On your damaged Gravity Centrifuge, if two consecutive bits in the bitstream are set, the twin inertial drive overheats and burns down.
So don’t do that.
As far as I understand the solution is to insert a ‘0’ bit between each pair of ‘1’ consecutive bits, Am I right ?
Any help will be greatly appreciated
It’s not strictly needed to understand it to solve the puzzle. It’s just there as an extra optimization enabler… for those who see it.
No, no, that’s not the idea It’s not an “extra rule” to confuse people, it’s there as an additional constraint to the allowed solutions. (as a problem setter, I needed because without it I can’t have a unique validator output).
See it this way: among the possible solutions to the problem, only output one that wouldn’t overheat.
For people who are not into maths, “medium” difficulty can be misleading.
This puzzle is based on a theorem and a method you’ll have to lookup if you don’t know it already. Trying to come up with a solution by trial and error is a total waste of time.
The needed keyword is hidden somewhere. Look closely and you’ll find it.
Once the trick is found, 98% of the code is already done.