Current location - Training Enrollment Network - Mathematics courses - How to pile things and matches?
How to pile things and matches?
Question 1: There are three piles of matches, two in the first pile, two in the second pile and three in the third pile.

The person who takes this question first will lose, and the winning strategy is to let the other side take it first. No matter how the person who takes it first takes it, the person who takes it later wins as long as he stays in a stable state (what is a stable state, which will be explained later).

Question 2: 16 is divided into four piles, 1, 3, 5, 7, and the last one wins.

===============================

The ultimate solution to the problem of picking matches;

The key to winning or losing the match problem is to judge whether the number of matches is in a stable state. Whoever takes matches can get a stable state, and whoever destroys the stable state with matches loses.

To judge the steady state, we need to use the binary representation of numbers. Remember to use the binary representation of decimal numbers:

1=000 1

2=00 10

3=00 1 1

4=0 100

5=0 10 1

6=0 1 10

7=0 1 1 1

8= 1000

9= 100 1

In the above binary system, 1 stands for 1, one tenth of 1 stands for 2, one percent of 1 stands for 4, and one thousandth of 1 stands for 8. For example, 100 1 stands for 8 in thousands and 1 stands for 1 in units, so1001= 8+1= 9; Similarly, 011= 4+2+1= 7.

Judgment of steady state: align the binary representations of several piles of matches one by one. If the number of 1 in each number, such as 10, 100, 1000, is even (0, 2, 4, ...), this group of matching numbers constitutes a steady state. As long as the number of 1 in any digit is not even, the matching number of this group is unstable.

Question 1, 3 piles of matches, each pile has 1, 2, 3 respectively. Two people can take 1 from any pile or all at once, and the winner is the last one.

The binary representation of the three digits of the status 1, 2 and 3 is as follows:

1=000 1

2=00 10

3=00 1 1

This set of numbers has two 1 in one place and two 1 in ten places, so this set of numbers is in a stable state. In a stable state, whoever takes the match first will destroy the stable state and turn it into an unstable state anyway, while the person who takes the match behind will definitely win by taking the match to turn the unstable state into a stable state.

Question 1, 3 piles of matches, each pile has 1, 2, 3 respectively. Two people can take 1 from any pile or all at once, and the winner is the last one.

The binary representation of the three digits of the status 1, 2 and 3 is as follows:

1=000 1

2=00 10

3=00 1 1

This set of numbers has two 1 in one place and two 1 in ten places, so this set of numbers is in a stable state. In a stable state, whoever takes the match first will destroy the stable state and turn it into an unstable state anyway, while the person who takes the match behind will definitely win by taking the match to turn the unstable state into a stable state.

Question 2: Suppose there are four piles of matches, each pile has 1, 3, 5, 7, and two people can take 1 from any pile or all of them at once, and the person who gets the match finally wins.

The binary representations of the three digits of the status 1, 3, 5 and 7 are as follows:

1=000 1

3=00 1 1

5=0 10 1

7=0 1 1 1

This set of numbers has four 1 digits, two 1 digits and two 1 digits, which are relatively stable. In a stable state, whoever takes the match first will destroy the stable state and turn it into an unstable state anyway, while the person who takes the match behind will definitely win by taking the match to turn the unstable state into a stable state.

Give a few more examples to illustrate the final solution to the problem of taking matches.

Example 1. Suppose there are three piles of matches, with three, five and seven matches in each pile. Two people can take 1 from any pile or all at once, and the last match is the winner.

The binary representations of the three numbers of states 3, 5 and 7 are as follows:

3=00 1 1

5=0 10 1

7=0 1 1 1

There are three 1 in this set of numbers, two 1 in the decimal number and two 1 in the hundredth number, so this set of numbers is unstable. In an unstable state, as long as the unstable state is transformed into a stable state by taking a match, the person who takes the match first can win.

In the unstable state of 3, 5 and 7, there are three ways to change the matching number to a stable state, that is, from the first heap to 2, 5 and 7, or from the second heap to 3, 4 and 7, or from the third heap to 3, 5 and 6. These three states are steady states, such as:

2=00 10

5=0 10 1

7=0 1 1 1

The number of 1 in hundreds is even 2, which is stable.

3=00 1 1

4=0 100

7=0 1 1 1

The number of 1 in hundreds is even 2, which is stable.

3=00 1 1

5=0 10 1

6=0 1 10

The number of 1 in hundreds is even 2, which is stable.

In the face of the above-mentioned stable state, the person holding the match behind will destroy the stable state and become unstable, and will inevitably lose.

Suppose the last card taker takes two pieces from the third pile, and the number of matching piles becomes 2, 5 and 5, which becomes unstable.

2=00 10

5=0 10 1

5=0 10 1

The decimal number is only 1 1, which is unstable.

At this time, the only correct way to take the first place is to take the first pile, and the matching number becomes: 0, 5, 5, and turns to a stable state.

0=0000

5=0 10 1

5=0 10 1

There are two 1 in the unit, the tenth 0 1 and the hundredth 2 1, which is stable.

In a word, the first receiver will win as long as he transforms all the unstable states he encounters later into stable states.

Example 2: Suppose there are three piles of matches, each pile contains three, four and five matches. Two people can take 1 from any pile or all of them at one time, and the person who gets the match last time wins.

The binary representations of the three numbers of states 3, 4 and 5 are as follows:

3=00 1 1

4=0 100

5=0 10 1

There are two 1 in one digit, only 1 in ten digits and two 1 in hundreds, so this set of numbers is unstable. The first person who takes it has only one way: take two matches from the first pile, turn this set of numbers into a stable state of 1, 4,5, and you can win.

1=000 1

4=0 100

5=0 10 1

There are two 1 in the unit, zero 1 in the tenth and two 1 in the hundredth, so it is in a stable state.

Example 3: Suppose there are 4 piles of matches, each pile contains 3, 4, 5 and 6 matches, and two people can take 1 from any pile or all at once, and the last match is the winner.

The binary representations of the four numbers of states 3, 4, 5 and 6 are as follows:

3=00 1 1

4=0 100

5=0 10 1

6=0 1 10

This set of numbers has two 1 in the unit, two 1 in the decimal place and three 1 in the hundredth place. This set of numbers is unstable. The first receiver, as long as the number of 1 is reduced as much as possible in the hundreds, can turn this group of numbers into a stable state. There are three ways to take this number, that is, convert the number of four piles of matches into: 3, 0, 5, 6, or 3, 4, 1, 6 or 3, 4, 5, 2.

Example 4: Suppose there are four piles of matches, each with 6, 7, 8 and 9 matches. Two people can take 1 from any pile or all piles at once, and the person who gets the match last time wins.

The binary representations of the four numbers of states 6, 7, 8 and 9 are as follows:

6=0 1 10

7=0 1 1 1

8= 1000

9= 100 1

This set of numbers has two 1 in the unit, the tenth has two 1, the hundredth has two 1, and the thousandth has two 1. This set of figures is in a stable state.

Whoever takes the game first, no matter how to take it, will undermine stability, and whoever takes it first will lose. As long as the latter brings the unstable state destroyed by the former into a stable state, it will surely win.