Editorial for TLE '16 Contest 8 P2 - Dank Meme
Remember to use this editorial only when stuck, and not to copy-paste code from it. Please be respectful to the problem author and editorialist.
Submitting an official solution before solving the problem yourself is a bannable offence.
Submitting an official solution before solving the problem yourself is a bannable offence.
Author:
Another straightforward implementation problem. This problem can be done especially quickly using certain Python methods.
One method of implementing a solution is to push the individual binary digits of the number into a stack until that number is 0
. Keep in mind that by doing this, we need to handle the case if the number is 0
, which can be done with a rare "do-while" loop. Afterward, pop the stack and replace 1
s with dank
and 0
s with meme
. Make sure that you do not forget to include the trailing zeros.
Time Complexity:
Comments
I discovered that you get 50/100 if you do not handle the corner case of 0.