CKWLK (cakewalk) - Could anyone tell me what is wrong in my code?

So, it is the link to the problem cakewalk in maths section, Cakewalk - Problems | CodeChef

here it is the link to my solution, Solution: 93156420 | CodeChef

could anyone tell me why is it rejected?

There are 2 things wrong with your code :

  1. Consider the testcase where n = 120000, your else if consdition is satisfied so your code outputs “YES” whereas the answer is actually “No” because you can’t build 120000 by only multiplying 10s and 20s.

Now you may think n = 12000 should also output “YES” because cnt = 3 and floor(log2(12) ) = 3
( and so did I) but for some reason while comparing it considers the ceil value so it gives the correct answer but any more zeros and it outputs the wrong answer.

  1. And your second mistake is just that you are printing “YES” and “NO” instead of “Yes” and “No” .

Thanks alot.