An alternative use for XORing numbers greater than 1: The game of Nim. I
think this is where I first learned about the operation.
On 9 May 2011 21:44, "Marcelo Ramires" <marcelo.f.rami...@gmail.com> wrote:
> I understood how to solve this, but *how does one come to this solution ?*
> *
> If the xor of all numbers is zero, you can pick any candy, and the xor to
> this number is going to be equal to the xor from the rest of them.*
>
> I get this, if I have 9 numbers with XOR 3, XORing it with 3 will get me
> zero.
>
> How has everybody thought of this at the same time ? have I skipped a
logics
> class ? is this concept so disseminated among coders ?
>
> I had never XORed nubmers before this code jam, only booleans, and I
didn't
> know you could.
>
> As a side questions, can anybody tell me any alternative uses for XORing
> integers other than 1 and 0 ?
>
> Thanks!
>
> Marcelo Ramires
>
> On Sun, May 8, 2011 at 1:50 AM, vivek dhiman <vivek4dhi...@gmail.com>
wrote:
>
>> Lucky!
>>
>> You are right.
>>
>> if xor of two lists is same. (say xor1 = xo2)
>>
>> So the exor of these two wil be 0 (xor (xor1,xor2) = 0)
>> Or in other words lists can be divided if the xor of all the elements is
>> zero.
>>
>> :)
>>
>>
>>
>>
>> On Sun, May 8, 2011 at 8:17 AM, keshav agarwal <keshav...@gmail.com
>wrote:
>>
>>> please tell me of my logic was correct or i just got lucky to get it
>>> correct
>>>
>>> if xor to a list of nos. is zero only then the division is possible
>>> in this case patrick can be given the one candy with lowest value while
>>> sean keeps the rest
>>>
>>> if xor(n nos.)=0
>>> then (nth no.) xor (xor of n-1 nos.)=0
>>>
>>> so patrick gets the nth candy and sean keeps the rest
>>>
>>> --
>>> You received this message because you are subscribed to the Google
Groups
>>> "google-codejam" group.
>>> To post to this group, send email to google-code@googlegroups.com.
>>> To unsubscribe from this group, send email to
>>> google-code+unsubscr...@googlegroups.com.
>>> For more options, visit this group at
>>> http://groups.google.com/group/google-code?hl=en.
>>>
>>
>>
>>
>> --
>> Regards
>> Vivek Dhiman
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "google-codejam" group.
>> To post to this group, send email to google-code@googlegroups.com.
>> To unsubscribe from this group, send email to
>> google-code+unsubscr...@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/google-code?hl=en.
>>
>
> --
> You received this message because you are subscribed to the Google Groups
"google-codejam" group.
> To post to this group, send email to google-code@googlegroups.com.
> To unsubscribe from this group, send email to
google-code+unsubscr...@googlegroups.com.
> For more options, visit this group at
http://groups.google.com/group/google-code?hl=en.
>

-- 
You received this message because you are subscribed to the Google Groups 
"google-codejam" group.
To post to this group, send email to google-code@googlegroups.com.
To unsubscribe from this group, send email to 
google-code+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-code?hl=en.

Reply via email to