I turned from AC to TLE too.
After thinking a lot about it, I came up with special cases that require millions of iterations before halting at the correct answer. I guess they put these kind of cases in. They can't be solved in the 'normal' way (by doing the iterations, but have to be 'short circuited' first. But I have no idea how to do the short circuiting...
Code: Select all
10
1977326743 11
1220703125 21
1162261467 10
2147483648 6
22 11
33 11
55 11
2 4
3 9
5 25
1
2
0
Takes several seconds to complete on my machine (which is much faster than the judge's). It is not too difficult to see the correct answer (11) for an intelligent human being, but putting that intelligence into a program is another thing.
So, if you find a way around, please let us know...
-little joey