微软招聘题,走过路过不要错过。

微软招聘题,走过路过不要错过。

原题:
一个大院子里住了50户人家,每家都养了一条狗,有一天他们接到通知说院子里有狗生病了,并要求所有主人在发现自己家狗生病的当天就要把狗枪杀掉。然而所有主人和他们的狗都不能够离开自己的房子,主人与主人之间也不能通过任何方式进行沟通,他们能做的只是通过窗户观察别人家的狗是否生病从而判断自己的狗病否。(就是说,每个主人只能看出其他49家的狗是不是生病,单独看自己的狗是看不出来的)
第一天没有枪声,第二天还是没有枪声,第三天传出一阵枪声,问有多少条狗被枪杀。
 

看答案[鼠标在此处按住不动,并向下拖动]

分析(ill dog=ig)
if ig=1, the owner of the dog kill his/her dog in the first day, since he/she
finds there is no ill dog outside his house.

if ig=2, no body kills the dog in the first day, because they see at least
1 ig outside the their house.
the next day, everyone knows ig<>1, so if ig=2, the onwers of the two igs will
kill his/her dos. so ig<>2.

ig=3 following ig=2’s analysis, the third day, everone knows that ig<>1 or 2,
the three onwers of the igs kill their dogs one by one or in the same time,
because each of them see two igs outside.

so three dogs are killed.

ig=3 following ig=2’s analysis, the third day, everone knows that ig<>1 or 2,
the three onwers of the igs kill their dogs one by one or in the same time,
because each of them see two igs outside.

so three dogs are killed.

One thought on “微软招聘题,走过路过不要错过。

  1. wow power leveling
    wow power leveling
    wow power leveling
    wow power leveling
    wow power leveling
    wow power leveling
    wow power leveling
    wow power leveling
    wow power leveling
    wow power leveling
    wow power leveling
    wow power leveling
    wow power leveling
    wow power leveling
    wow power leveling
    wow power leveling
    wow power leveling
    wow power leveling
    wow power leveling
    wow power leveling
    wow power leveling
    wow power leveling
    wow power leveling
    wow power leveling
    wow power leveling
    wow power leveling
    wow power leveling
    wow power leveling
    wow power leveling
    wow power leveling
    wow power leveling
    wow power leveling
    wow power leveling
    wow power leveling -229815661746543

Leave a Reply

Your email address will not be published. Required fields are marked *