Sick dog problem

Source: Internet
Author: User
Q: There is a village with N families, each family has a dog.
One day, the villagers were informed that there was a sick dog in the village. So everyone took the dog to other villagers to observe. It is known that every inhabitant can observe the dogs of other residents and determine exactly which dogs are sick, but they do not correctly judge whether their dog is sick or not. However, the villagers could not communicate with each other. If the villagers decided that their dog was a sick dog, they would shoot him on the same day. Every villager is extremely intelligent. By the first day, the village sounded a gunshot. How many dogs have been killed, please?
A: The most afraid of this strange intellectual problem orz ...
In fact, this problem can be thought: from the point of view of the sick dog owners
With a diseased dog:
The first day all the villagers led the dog to the streets, the dog owner found other people's dogs do not have a sick dog. So make sure your dog is a sick dog. So the first day of the night to kill the dog. There are two sick dogs:
The owner of the sick dog is a and b. The first day all the villagers lead the dog to the street, A and b all see each other's sick dog, think their own not sick. So there was no gunshot on the first day. The second day a found B's sick dog. If your dog is not sick then B should have found B himself dog said sick dog and the night before should be killed, this shows that B also saw a sick dog, so a understand his dog is also a sick dog. b the same. So the next night A and B both killed their own dogs.
There are three sick dogs:
The host of a sick dog is a, B, C. The first day of sick dog owners saw other people's two sick dogs, thought their own not sick. The next day a saw two sick dogs, thought it was only two sick dogs, and B and C on the same day will kill their own sick dog. But the third day a saw the two sick dogs again. So a understands the truth. B, c the same. So the third night, ABC each killed his own sick dog.

etc... If the shooting of the K-day sounded, indicating that there is K disease dog. The result is irrelevant to N.

Sick dog 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.