CHAPD - Editorial

This is genius :smiley:

Awesome :smiley:

Sorry, my mistake.

i didn’t know codechef allowed such large source files. i guess more care should be taken to prevent such submissions :stuck_out_tongue:

I didn’t get this can you please explain in details… please…

I tried to factor b, but got TLE. I used Pollard’s rho. CodeChef: Practical coding for everyone It’s not faster than trial division: CodeChef: Practical coding for everyone

print ‘Yes’ if (a**18)%b==0 else ‘No’
^This works too. Maybe the test cases are weak.

Yes! we need to think a problem in a logical fashion. Applying some basic math can solve this problem. We should write code but not scrap :slight_smile:

@rishabhprsd7 Refer to this, was too long to comment.
http://discuss.codechef.com/questions/69951/chapd-editorial/70614

@ ambarpal
I cant understand this
the largest necessary “x” occurs when A = p, B = p^x. Since A,B <= 10^18, with p = 2, we get the largest neccesary x as ceil(log2(10^18)) which is around 60.
can u explain this??

really a good approch learned somthing new!!