Wednesday, January 29, 2014

SPOJ 9948. Will it ever stop

Here is the problem statement.
In this problem we need to notice that it will stop if at some point n will be 2 and with teh first if statement it will turn 1 and the cycle will break. If N has divisors other than the powers of 2 => that the cycle is unbreakable. So we only need to check if the given nurmber is a power of 2 or not.


       DOWNLOAD THE FULL SOURCE CODE

No comments:

Post a Comment