2 players r playing a game. They have A bundles of Pencils each of size B. The player who can’t make move loses. For each move, a person choses a bundle and divides into some number(more than 1) of equal bundles. The size of each bundle is integer and is no less than C.
1<=A<=10^5
1<=B,C<=10^9
Example:
Just a observation , If B has no factor between [C,B) ==>ans=0(can’t divide equally by 1st player).
if it has a factor ->. if (A is odd){return 1;} else {return 0;}
Can be proved easily . Ask me if you didn’t understand last line
@ssjgz s bro. once one of the bundless of size B out of A are divided, they can also be divided by other person. There r many problems in hackrank. can u pls give the precise sol.?
B=92 can we divided into 4 equal parts of 23 each. And since A is odd ans will be 1. Basically in every case 1st person can play optimally to win in this test case.Sorry By mistake I wrote [C,sqrt(B)]. It is basically [C,B) . I did this question in contest and it worked fine…