There are two cases:

1) the XOR of all numbers is 0:
the first player HAS TO change it to a nonzero value.
reason: 0^X=0 -> X=0

2) the XOR of all numbers is not 0:
the first player always CAN make such a move to achieve the XOR of 0.
reason: try to find it yourself (hint: prove that always we can choose a
number which is greater than the XOR of the rest)

if the first player try to keep the opponent in XOR=0 position, he can
win the game.

read the wiki page for nim game if you had problems with it.

Good Luck,
Nima


On Sun, 2009-08-16 at 14:51 +0530, ankur aggarwal wrote:
> anybody understand the logic behind xoring ??
> plz explain to me. 
>  
> ankur aggarwal
> 
> 
> > 

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at http://groups.google.com/group/algogeeks
-~----------~----~----~----~------~----~------~--~---

Reply via email to