zoukankan      html  css  js  c++  java
  • A funny question

    Q:Every man in a village of 100 married couples has cheated on his wife. Every wife in the village instantly knows when a man other than her husband has cheated, but does not know when her own husband has. The village has a law that does not allow for adultery. Any wife who can prove that her husband is unfaithful must kill him that very day. The women of the village would never disobey this law. One day, the queen of the village visits and annoces that at least one husband has benn unfaithful. What happens?

    A:The queen said "at least one husband", so maybe more than one husband has been unfaithful.

    1. There is only one cheat husband. Assume the husband is A.

     First day, 99 wives except A's wife know A is unfaithful, but A know none of husbands is unfaithful. so A got the information from queen that her husband is cheeting. So she kill her husband, everything is over.

    2. There are two cheat husband. Assume they are A & B.

     First day, every wives know someone of husbands are unfaithful. So no man die. 

     Second day, because no one die in first day.Wives know there are more than one husband are cheeting, but A's wife and B's wife only know one, so they will kill their husbands.

    Same goes to 3,4,5...100 cheeting husbands.

    Conclusion:

     If there are N cheeting husband, in prime N-1 days, no husband have been killed, at the Nth day, N hasbands will be killed by their wives. 

  • 相关阅读:
    如何在三维坐标中选择点
    java slider
    java combobox 多选框
    java BorderFrame.java
    java radioButton
    java checkbox
    java 文本窗口
    constexpr
    测试框架
    java 计算器
  • 原文地址:https://www.cnblogs.com/triStoneL/p/1905312.html
Copyright © 2011-2022 走看看