Hi Anil,

If u observer carefully u find that,

1. the way the sum is happening in the problem that r nothing but the XOR of
two numbers.

2. There is a nice property of binary numbers.....rather than using the
combination the same is achieved as,
    If u take the XOR of all the numbers and if its not equal to zero then
there is no divison is possible and in case
    of zero, just we subtract the smallest number.

There are always some tricky solution exist, just will need the approach.

On Sun, May 8, 2011 at 12:11 PM, anilsoni85 <[email protected]> wrote:

> While solving the CandySplitting problem yesterday i was thinking the
> problem can be solve in folllowing steps
>
> 1. Read the candies value and put them in an array of int.
> 2. Create combination of different way sean can split the candies.
> Like for 2nd sample example possible combination could be
>     Sean          Patrick   Sean Sum of his own Candies     Patrick's
> XOR of Sean & Patrick candies
>      3               5,6
> 3                                                       3           3
>      5               3,6
> 5                                                       5           5
>      6               3,5
> 6                                                       6           6
>      3,5            6
> 8                                                       6           6
>      3,6            5
> 9                                                       5           5
>      5,6            3
> 11                                                     3           3
>
> Sean maximum Sum of candies where Patrick & Sean candies XOR equal is
> 11 so the solution is 11
>
> But in solutions i did not found anyone's solution using this
> approch...and now i am having doubt n how the problem can be solved
> without combinations.
>
> --
> 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.

Reply via email to