- I am getting hard time with this problem-lightoj 1296 — Again Stone GameThere are N-piles,each pile contains max 2^31 stones. you must have to pick at least one and you can pick at most half of the stones. I have seen solutions of this problem but I still don't understand how it works :(. I will be using term SGN as Sprague-Grundy Number. If a pile has 3 stones what should be its SGN? my analysis says it should be like-
-
- SGN(1)=0,
-
- SGN(2)= mex(1) = 1, since we must have to take 1 stone, we have only one choice
-
- SGN(3)= mex(1) = 1, since we must have to take 1 stone, we have only one choice
-
- Now the solution to this problem I have seen says SGN(3) is 0 which unfortunately, I don't understand how :(
- I have just started to learn Sprague-Grundy Number. I am looking for help to make me understanding how the calculation of SGN is defined for this problem. May be I have misunderstood the meaning of MEX defined in SGN.