爱因斯坦谜题解答(三种算法比较).docx

  1. 1、本文档共45页,可阅读全部内容。
  2. 2、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。
  3. 3、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载
  4. 4、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
查看更多
爱因斯坦谜题解答(三种算法比较)

爱因斯坦谜题:??? 在一条街上有颜色互不相同的五栋房子,不同国籍的人分别住在这五栋房子力,每人抽不同品牌的香烟,喝不同的饮料,养不同的宠物。已知如下情况:1.? 英国人住红色房子里。2.? 瑞典人养狗。3.? 丹麦人喝茶。4.? 绿色房子坐落在白色房子的左面。5.? 绿色房子的主人喝咖啡。6.? 抽Pall Mall香烟的人养鸟。7.? 黄色房子的主人抽Dunhill香烟。8.? 挪威人住第一间房子。9.? 五座房子中间的那座的主人喝牛奶。10. 抽Blends香烟的住在养猫人的隔壁。11. 养马的人住在抽Dunhill香烟者的隔壁。12. 抽Blue Master香烟的喝啤酒。13. 德国人抽Prince香烟。14. 挪威人住的房子在蓝色房子的隔壁。15. 抽Blends香烟的人有一个喝水的邻居。问:谁养鱼??谜题的英文原文:Let us assume that there are five houses of different colors next to each other on the same road. In each house lives a man of a different nationality. Every man has his favorite drink, his favorite brand of cigarettes, and keeps pets of a particular kind. 1.The Englishman lives in the red house. 2.The Swede keeps dogs. 3.The Dane drinks tea. 4.The green house is just to the left of the white one. 5.The owner of the green house drinks coffee. 6.The Pall Mall smoker keeps birds. 7.The owner of the yellow house smokes Dunhills. 8.The man in the center house drinks milk. 9.The Norwegian lives in the first house. 10.The Blend smoker has a neighbor who keeps cats. 11.The man who smokes Blue Masters drinks bier. 12.The man who keeps horses lives next to the Dunhill smoker. 13.The German smokes Prince. 14.The Norwegian lives next to the blue house. 15.The Blend smoker has a neighbor who drinks water. The question to be answered is: Who keeps fish??这道迷题出自1981年柏林的德国逻辑思考学院。据说世界上只有2%的人能出答案。就连大名鼎鼎的爱因斯坦也成为此题大伤脑筋,所以这道题也经常被国内外知名公司用做面试题目,相信许多朋友都只做出过一个答案,今天就用计算机来看看答案:?C#代码(代码来源:/art/32294061_1.html,在此感谢原作者):using?System;namespace?netsafe.math{????public?class?ayst????{????????///?summary????????///?问题中的所有元素????????///?/summary????????string[,]?data?=?{?{黄房子,蓝房子,白房子,红房子,绿房子},???????????????????????????{挪威人,英国人,德国人,丹麦人,瑞典人},???????????????????????????{DUNHILL,PRINCE,混合烟,?PALL?MALL,BLUE?MASTER},???????????????????????????{咖?啡,矿泉水,茶,牛奶,?啤酒?},???????????????????????????{鱼,?恐龙,马,????鸟,狗}?????????????????????????};????????///?summary///?answer用来存放答案????????///?/summary????????int[,]?answer?=?new?int[6,?6];????????int

文档评论(0)

xcs88858 + 关注
实名认证
内容提供者

该用户很懒,什么也没介绍

版权声明书
用户编号:8130065136000003

1亿VIP精品文档

相关文档