u can do a lot of stuff with the bitwise operators , u just gotta experiment with it
On Tue, May 10, 2011 at 2:21 AM, Morgan Bauer <[email protected]>wrote: > XOR is the bread and butter of Symmetric Cryptography. > ~mhb > > On Mon, May 9, 2011 at 4:44 PM, Marcelo Ramires > <[email protected]> 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 <[email protected]> > 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 <[email protected]> > >> 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 [email protected]. > >>> To unsubscribe from this group, send email to > >>> [email protected]. > >>> 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 [email protected]. > >> To unsubscribe from this group, send email to > >> [email protected]. > >> 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 [email protected]. > > To unsubscribe from this group, send email to > > [email protected]. > > 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 [email protected]. > To unsubscribe from this group, send email to > [email protected]. > For more options, visit this group at > http://groups.google.com/group/google-code?hl=en. > > -- * K.Rahul ) * -- You received this message because you are subscribed to the Google Groups "google-codejam" 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/google-code?hl=en.
