A Java interview with a monthly salary

Source: Internet
Author: User
At the beginning of the IQ test: Both xiaohe and Xiaoqiang are students of Teacher Zhang. The birthday of Miss Zhang is a day of the month, and neither of them knows the birthday of Miss Zhang. Birthday is one day in the following 10 groups: March 4 March 5 March 8 June 4 June 7 September 1 September 5 December 1 December 2 Miss Zhang told James about the month and told Xiaoqiang about the day, teacher Zhang asked them if they knew his birthday was that day? James said: If I don't know, I certainly don't know. Xiaoqiang said: I didn't know either, but now I know. James said: Oh, I know. Based on the preceding dialog, determine the day of Miss Zhang's birthday? The answer is: January 1, September 1. 1. James said, "if I don't know, I'm sure I don't know ". The subline of this sentence is actually: "I should have guessed it. If I guess it is wrong, Xiaoqiang certainly does not know it ". But James is still not sure whether he guessed it right or not. He needs to confirm it with Jack. What value does M take for James to say so? Obviously, 6 and 12 are not advisable. If M is 6 or 12, N may be 2 or 7. Jack can know Miss Zhang's birthday with 2 or 7 digits. M can only be 3 or 9, while n can only be set to 1, 4, 5, or 8. If M is 3, N, three values can be obtained, and the result is "If James does not know, Xiaoqiang may know (2--8 ), it may also be unknown (3-5 ). ", In this case, James said, "if I don't know, I'm sure I don't know." James is not so confident. If M is 9, James knows that N can only be 1 or 5. At this time, James's guess is that n = 1, and N is not 1, James is not sure, if n is not 1 but 5, then James said, "if I don't know, I'm sure I don't know ". At this point, James knows that there are only two possible results: wait for Xiaoqiang to confirm whether N is 5. 2. Xiaoqiang said, "I didn't know either, but now I know ". Xiaoqiang said, "I didn't know", and verified that N is indeed not 2 or 7. At the same time, Xiaoqiang also knew that "m is not 6 or 12, M is only available for 3 and 9 ". If n is 5, then Xiaoqiang should say "I didn't know, but I still don't know ". According to the inference in Section 1, n = 1, so Xiaoqiang can say "I didn't know, but now I know ". 3. James said, "Then I know." James waited for Xiaoqiang's sentence. No matter how Xiaoqiang answered the question, James knew the correct answer. If Xiaoqiang says "I still don't know", then James can still know that "only n = 5 will make Xiaoqiang confused", so the answer is September 5. If Xiaoqiang says "I know ", so it must be September 1. In fact, James understands from beginning to end. He only needs Xiao Qiang to say a word to verify his guess. For Xiao Ming, it is a non-A (B) choice question. Therefore, according to the story of the question itself, James's third sentence is not needed. Many people use this condition when deriving it-it's a bit like doing a math problem.

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.