sorry, i mean smallest( not sum of smallest, as smallest means a single
element)
2
5 5
101->5
101->5
------
000  -> xor
=0 hence has a solution
so ans=(total sum -smallest)
total sum=5+5=10
smallest=5 -> as minimun(5,5)=5
so ans=(10-5)=5

2nd ex
3 5 6
011->3
101->3
-----------xor
110
110->6
----------xor
000
=0, so has a solution
so ans=(total sum -smallest)
total sum=3+5+6=14
smallest=5 -> as minimun(3,5,6)=3
so ans=(14-3)=11

Is that clear?


On Mon, May 9, 2011 at 12:04 PM, Nikhil Agarwal
<nikhil.bhoja...@gmail.com>wrote:

> @Anurag  What do you mean by sum of smallest...please explain.In
>
> 2
> 5 5
>
> and
>
> 3
> 3 5 6
>
> On Mon, May 9, 2011 at 12:10 AM, kumar anurag 
> <anurag.it.jo...@gmail.com>wrote:
>
>> find xor of all elements - if its equal to zeo then Case has solution
>> otherwise NO
>> for finding the soltuion just sort all the elements and find the (sum of
>> all -sum of smallest)..
>>
>>
>>
>> On Sun, May 8, 2011 at 9:50 PM, Kunal Patil <kp101...@gmail.com> wrote:
>>
>>> Can anybody tell me How to solve candy splitting problem appeared in
>>> Google Code Jam Qualification round?
>>> I know there is solution, if XOR of all elements comes to be zero.
>>> But i wasn't able to proceed from there as I couldn't think of way how to
>>> partition that elements.
>>> (I have read solutions from other contestants but as expected they are
>>> dirty for the one who doesn't know logic behind program)
>>> So plz help...
>>>
>>> --
>>> You received this message because you are subscribed to the Google Groups
>>> "Algorithm Geeks" group.
>>> To post to this group, send email to algogeeks@googlegroups.com.
>>> To unsubscribe from this group, send email to
>>> algogeeks+unsubscr...@googlegroups.com.
>>> For more options, visit this group at
>>> http://groups.google.com/group/algogeeks?hl=en.
>>>
>>
>>
>>
>> --
>> Kumar Anurag
>>
>>  --
>> You received this message because you are subscribed to the Google Groups
>> "Algorithm Geeks" group.
>> To post to this group, send email to algogeeks@googlegroups.com.
>> To unsubscribe from this group, send email to
>> algogeeks+unsubscr...@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/algogeeks?hl=en.
>>
>
>
>
> --
> Thanks & Regards
> Nikhil Agarwal
> B.Tech. in Computer Science & Engineering
> National Institute Of Technology, Durgapur,India
> http://tech-nikk.blogspot.com
> http://beta.freshersworld.com/communities/nitd
>
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algogeeks@googlegroups.com.
> To unsubscribe from this group, send email to
> algogeeks+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>



-- 
Kumar Anurag

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

Reply via email to