Java abstraction-Teacher's birthday-logical thinking-interesting face test-ground tornado

Source: Internet
Author: User

(-1) write in front

Have to go to Beijing, abruptly to arrange a Java exam, for those special details of the things I forget it also do not feel anything bad, remember before, also have seen, but usually not commonly used connection broken, but you rote is useless, a period of time or will forget, the only way is to do more things, Theory with practice, on the contrary, I feel very interesting, but also on the internet to see a lot of explanations, feel that there are shortcomings, the following is my answer.

(0) Detailed explanation

Set up a teacher's birthday for M-month N-day. Tell the student a (that is, the month that the student knows the teacher is born) and tell the student B (that is, the student B knows the day the teacher was born). The following dates are available: March 4, March 8, March 10, June 4, June 7, September 1, September 10, December 1, December 2, December 8

One of them is the teacher's birthday.

Current student a dialogue with Student B:

Student A: If I don't know, you must not know.

Student B: I don't know, now I know.

Student A: I know that, too.

Now ask: What day is the teacher's birthday?

The first sentence of a

First we look at the characteristics of the data, the data is composed of the month and date, A is aware of the month, the data of the month is 3,6,9,12, a can not be known by the month information of the teacher's birthday, a know that B can not be inferred from the date of the correct month.

A know is the March date has 4,8,10

A known June date is 4, 7

A know is the September date has 1,10

A know is the December date has 2,8

We found 7th, 2nd is the only, also shows that if a know is June, then B know is 7th, guess the birthday, a will not say you must not know, so a know is not June, similarly, a know is not December.

The first sentence of B

According to the first sentence of a, the remaining data are as follows:

A know is the March date has 4,8,10

A know is the September date has 1,10

B in the first half of the sentence there is ambiguity, a case, B think a can be introduced through the month birthday, then the date of B is 2 or 7, which is inconsistent with the conclusion of the first sentence. Then is the second case, b at this time through a words inferred from the above conclusion, according to their own date to judge a month, obviously 10 is wrong, if it is 10, a month is not the only. Then the data is as follows:

A know is the March date has 4,8

You know, the September date is 1.

This seems to be possible March 4, March 8, September 1, because B knows that any of the corresponding months in 1,4,8 is unique.

The second sentence of a

This sentence to the answer to the September 1, because for a, if he knows the March, for the teacher's birthday on March 4 and March 8 two options, and if he knew September, only September 1 this kind of answer.

Java abstraction-Teacher's birthday-logical thinking-interesting face test-ground tornado

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.