This is one of the fun logic issues I earlmed. When I was very small, my father told me:
"There are 3 black hats, 2 white hats. Let three people come to a row from the back, give him
Everyone wears a hat. Everyone can't see the color of the hat wearing it, but
I can only see the color of the hat standing in front. (So the last person can see
The color of the two men's hat, the middle of the person can see the color of the person in front of the person
But I can't see the color of the person behind him, and the halt of the most in front of the person is watching
not see. Now starting from the last person, ask if he knows the color you wear,
If he replied that he didn't know, he continued to ask him in front of it. In fact, they wear three
They are all black hats, then the most in front of them will know that they wear black hats. why
? "
The answer is that the person in front of the person heard that the two people said, "I don't know", he
Suppose you wear a white hat, then the middle of the person saw the white hat he worried. Then
The middle of the middle will be reasonable: "Suppose I wear a white hat, then the last person is
I will see two white hats in front, but there are only two white hats, and he should understand him.
It's a black hat, now he doesn't know, explains that I have wear a white hat.
Wrong, so I wore a black hat. "The problem is that the middleman also said that I don't know, so the first
The person who knows that he wear a white hat is wrong, so he inferred his own black
hat.
We promote this problem into the following form:
"There are several colors of hats, each having a number of tops. It is assumed to have several individuals
Stocnented to a row, wear a hat on each of them. Everyone can't see themselves.
The color of the hat, and everyone can see the color of his hat in front of him.
But I can't see the color of the hat behind him. Now start from the last person,
Ask him if he knows the color you wear, if he replied, don't know, continue asking
He in front of him. I have been asking, then there must be a person who knows what I wear.
colour. "
Of course, it is necessary to assume some conditions:
1) First, the total number of hat must be greater than the number, otherwise the hat is not worn.
2) "There are several colors of the hat, each of the top, some people have a number of people" is a queue
All people know in advance, and everyone knows that everyone knows this, all
People know that everyone knows that everyone knows this, and so on. But in this condition
"Several" in the middle is not necessarily to give a number to a specific one. This information can be specifically
Like a classic form, you can list the number of each color hat
"There are 3 black hats, 2 white hats, 3 people",
can also be
"There is a red-yellow green hat each 1 top 2 top 3, but the specific
Know which color is a few, there are 6 people,
Even the specific number can also be,
"I don't know how many people are arranged in a row, there are two kinds of black and white hats, each cap
The number of sons is less than the number of people. "
At this time, the last person didn't know that he was ranked in the last - until started his time
I found that there was no other person before he replied that he knew that he was in the end. In this post
The part of the past When I got question, I will only write "there are several colors of the hat, each
Several top, have a number of people, this preset condition, because this part is determined, the title is also
deal.
3) The remaining hats don't worry on everyone is all hidden, the people in the team
I don't know what hats are left.
4) Everyone is not color blindness, not only, and as long as the two colors are different, they can
Said. Of course, their vision is also very good, can see where the front is far away. they
Extremely smart, logic reasoning is excellent. All in all, as long as theoretically derived according to logic, they must be derived. Instead, if they can't push their own cap
The color of the child, no one will try to guess or cheating - I don't know.
5) The people behind can't tell a whisper or knockout in front.
Of course, not all preset conditions can give a reasonable topic. For example, there are 99
Top-black hat, 99 top white hat, 2 people, no matter how to wear, no one knows
Heavy colors on the hat. In addition, as long as it is not a hat, it is only one
In a team of individuals, this person is impossible to say the color of his hat.
But the following topic is a reasonable question:
1) 3 red hat, 4 top black hat, 5 top white hat, 10 people.
2) 3 red hat, 4 top black hat, 5 top white hat, 8 people.
3) N, black hat, N-1 top white hat, n personal (n> 0).
4) 1 top color 1 hat, 2 top color 2 hats, ..., 99 top color 99 hat,
100 Hats of 100 colors, a total of 5,000 people.
5) There is a red-yellow green three colors of each 1 top 2 top 3, but don't know which color is
Top, there are 6 people.
6) I don't know how many people (at least two people) are arranged in a row, there are two black and white hats, each hat
The number of people is less than the number of people.
Everyone can do not look at me below, try to do these questions.
If you do it in the three-headed hat 2 top white cap, then 10 people
You can exhaust us, don't say 5,000 people. But 3) N is an abstract number, test
Considering how to solve this problem, it is good for solving the general problem.
Suppose now n is already wearing a hat, and the last person is in the last person.
What is the color of the hat, when will he answer "know"? Obviously, only
He saw that the N-1 person in front of him is like a white hat, because all the N-1 white
There is already light in the hat, which can only be on the black hat on his own head, as long as there is a black
Hat, then he can't rule out the possibility of black hat on his head - even if he saw
Everyone is a black hat, he is still likely to wear the Nth top black hat.
Now suppose the final answer is "I don't know", so the round is the second
people. According to the at the end of the answer, what can he infer? If he saw it
White hat, then he can immediately infer your black hat - if he also wears a white hat,
Then, the last person should see a white hat and ask him to answer "Know".
But if the second person sees at least a black hat in front of it, he can't make judgments.
- He may wear a white hat, but the black hat in front makes the last person can't return.
Answer "Know"; he naturally may wear a black hat.
Such reasoning can continue, but we have seen a slim. Last one
People can answer "know" when he saw it all the white hat, so he replied "I don't know
"When he only saw a black hat at least, this is
All hat color problems
key!
If the last person answers "I don't know", then he saw a black hat at least.
So if the second person see is a white hat, then the last person sees at least one
Where is the top black hat? Will not be elsewhere, can only be on the penultimate person's own head. such
The reasoning continues, and for everyone in the queue:
"Everyone behind me saw at least one black cap, otherwise they will follow the same judgment to determine what they wear it is a black hat, so if I saw the front of the people, my head I must wear the black hat that I saw behind me. "We know the most in front of the hats, you don't have to say the black hat.
Therefore, if everyone behind him replied, "I don't know", then according to the above
In reasoning, he can determine that you wear a black hat, because people behind him must see a top
Black cap - can only be the top of the first person. In fact, it is obvious, the first one
Say that person in what color hats on your head is the first wear from the head of the team.
The people in the black hat, that is, the first one from the number of teams, all people who have seen everyone wear a white cap.
Child.
Such reasoning may make people feel a bit of a cycle of argument, because the above
It contains "if others also use the same reasoning", which is logically
The prototype of the sample is a bit dangerous. But in fact, there is no cycle argument here, this is similar
The reasoning of the across the law, everyone's reasoning is built in the reason of these people behind him, and
For the last person, no one behind him, so his reasoning does not depend on other
People's reasoning can be established and is the first reasoning in summary. Slightly think, we
The above demonstration can be changed to inference suitable for any various colors:
"If we can make a hat in the queue from the hypothesis that the hat will appear in the queue, the first person who can't see this color can be judged according to the same argument as this argument, he Wearing this color hat. Now all my people will answer, so people behind me also see this color hat. If I can't see this color in front of me, then I must I am wearing this color hat. "
Of course, the initial reasoning of the first person is quite simple: "There must be this color in the queue.
Hat, now I can't see some of some people in front of it, then it can only be wear it in me.
The head is over. "
For questions 1) Things becomes very obvious, 3 red hats, 4 top black hats, 5 top white caps
The child is wearing 10 people, and each color is at least one in the queue, so it starts from the number of quilts.
A person who can't see a color of some color can determine the hat you wear this color.
Son, through this, we can also see that when you ask the third person from the head of the team,
There should be someone to answer "know", because the third person from the team can only see two
Top hat, so I saw the two colors, if the people behind him answered "I don't know",
Then he must have two colors in front of him, and he is wearing him is not seen.
The color of the color of the color.
Question 2), the same, 3 red hats, 4, black hats, 5 white hat to 8 people,
Then there must be at least one white hat in the queue, because the other colors add up to 7 top,
Therefore, someone will answer "know" in the queue.
The scale 4) is large, but the truth and 2) are exactly the same. 100 colors 5050
The top hat is to 5,000 people, the number of 99 colors in front of the front is 1 ... 99 = 4950,
Therefore, there must be a piece of 100 colors in the queue (at least 50 tops), so if you
The people behind him answered "I don't know", then the person who won't see the color 100 hat.
It can be determined to wear this color hat.
As for 5), 6) "There is a red-yellow green hat each 1 top 2 top, but the specific
Know which color is a few, there are 6 people, "and" I don't know how many people are arranged in a row, there is
Black and white hat, each hat is less than the number of people 1 ", the principle is exactly the same, I
It is not specifically analyzed. The last thing to point out is that we only argue it above, if we can
The number of various color hats and the number of people in the queue judges at least one of the colors.
The color of the color, then there must be one person to judge the color of the hat on his head. because
In order to answer "don't know", the people behind "don't know", the first one is the first
People who can't see this color can judge what they wear this color. but
This is not to say that he must answer "know" in the inquiry, because it may be
His way to judge the color of your hat on your head. For example, in question 2), if the queue
As follows: (Arrow means the direction of the people in the queue)
White black black black red red red white →
So, the first person in the tail can immediately answer the white hat on his head, because he saw the place.
Some 3 red hats and 4 top black hats can be left to him. It can only be white hat.