Title: There is a bucket, there are white ball, black ball each 100, people must follow the following rules to take out the ball:
1. Take out two balls each time from the inside of the barrel;
2, if it is two of the same color ball, then put a black ball;
3, if it is two different colors of the ball, and then put a white ball;
Q: What is the probability that there is only one black ball left in the last bucket?
Solution one: with black and white balls each two, to simulate, from small to many, the simplification of the complex, analysis and inference, to find out its inherent law, and summarized. Deduce: Each time a ball is reduced, the number of white balls is either unchanged after each ball, or two two decreases. So there must be only one black ball left in the end.
Solution Two: The Black ball number 0, the white Ball number 1, and then the equivalent is the XOR operation. After all the balls are different or the result is 0, so the last black ball is left.
The beauty of programming---a black and white ball in a barrel