hi Don, i think f(15,14,16) =|15-14|+|14-16|+|16-15| = 1+2+1=4, hou do you get f(15,14,16) = 5?
2011/9/6 Don <[email protected]> > No, f(15,14,16) = 5. > Don > > On Sep 5, 8:33 pm, wujin chen <[email protected]> wrote: > > hi all, i encountered this puzzle (http://www.crackpuzzles.com/?p=236): > > > > At one point, a remote island's population of chameleons was divided as > > follows: > > - 13 red chameleons > > - 15 green chameleons > > - 17 blue chameleons > > Each time two different colored chameleons would meet, they would change > > their color to the third one. (i.e.. If green meets red, they both change > > their color to blue.) Is it ever possible for all chameleons to become > the > > same color? Why or why not?" > > > > and the solution provided by auther is like this: > > *Solution: * > > Lets define a function f(red, blue, green) = |red - blue| + |blue - > green| + > > |green - red| > > When two chameleons of different colours meet and convert to the third > one, > > the value of function f will always change by 0 or 3 or 6 (i.e. a > multiple > > of 3). In the initial situation f is 8. > > If all of them get converted into a single colour then f would be 90 = > > 2*(red+blue+green) > > So we are basically looking for a solution to the equation: 8 + 3x = 90, > > which has no integer solutions. Hence it is not possible. > > > > well, my problem is this: > > > > f(13,15,17)=8, > > f(15,14,16)=2 > > so , we can see that " the value of function f will always change by 0 or > 3 > > or 6″ is not true, i am wondering~! > > -- > 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?hl=en. > > -- 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?hl=en.
