IBM recruitment questions

Source: Internet
Author: User

A. Suppose there is a sick dog. The host of the sick dog will see that the other dogs are not ill, so he will know that his dog is ill, so there will be a shot on the first night. Because there is no shot sound, it indicates that the number of dogs is greater than 1.
B. Suppose there are two sick dogs, and the host of the sick dog will see one sick dog, because the first day did not hear a gun. The number of sick dogs is greater than 1, so the host of the sick dog will know that his dog is a sick dog, so there will be a shot the next day. Since the second day is also shot, it indicates that the number of dogs is greater than 2.
From this reasoning, if the third day is shot, there will be three sick dogs.
Second Inference

1 if it is set to 1, the dog will die on the first day, because the dog owner does not see the sick dog, but the sick dog exists.

If 2 is used, the master of the diseased dog is a and B. A sees a sick dog, B also sees a sick dog, but a sees B's sick dog not dead. The number of unknown dogs is not 1, and others are not ill, so his dog must be a sick dog, but the idea of B is the same as that of.

Therefore, when the number is 2, the last two dogs will die on the first day.
3. If there are three, set the dog owner to A, B, and C. A sees two sick dogs on the first day. If a does not set his own dog, reasoning 2. If a does not set his own dog on the second day, the two dogs will not die, so the number of dogs is definitely not 2, other people are not ill, so their dogs must be ill, so they should be shot. B and C have the same idea as a, so they also shot.
Therefore, three dogs will die the next day.
4. If there are four, set the dog owner to A, B, C, and D. A saw three sick dogs on the first day. If a set his own dog instead of a, reasoning 3. When he watched the third day, the three dogs were not dead, so the number of dogs was definitely not 3, other people are not ill, so their dogs must be ill, so they should be shot. B and C and D have the same idea as a, so they should also shot.
Therefore, four dogs will die on the third day.
5. The remainder is recursive, and N is introduced from n-1 of the year.
Answer: N is 4. On the fourth day, the dog died, but on the third day, the answer was three.

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.