免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 1825 | 回复: 3
打印 上一主题 下一主题

爱因斯坦出的难题~~很老了, 谁能用c写个程序解一下? [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2004-08-29 00:10 |只看该作者 |倒序浏览
Einstein wrote a riddle last century. He said that 98% of the world could
not solve it.

Einstein's riddle
There are 5 houses in five different colors in a row.
In each house lives a person with a different nationality.
The five owners drink a certain type of beverage, smoke a certain brand of
cigar and keep a certain pet.
No owners have the same pet, smoke the same brand of cigar or drink the
same beverage.

The question is: Who owns the fish?

Einstein's hints:
1. The Brit lives in the red house
2. The Swede keeps dogs as pets
3. The Dane drinks tea
4. The green house is on the immediate left of the white house
5. The green house's owner drinks coffee
6. The person who smokes Pall Mall rears birds
7. The owner of the yellow house smokes Dunhill
8. The man living in the center house drinks milk
9. The Norwegian lives in the first house
10. The man who smokes blends lives next to the one who keeps cats
11. The man who keeps horses lives next to the one who smokes Dunhill
12. The owner who smokes BlueMaster drinks beer
13. The German smokes Prince
14. The Norwegian lives next to the blue house
15. The man who smokes blends has a neighbor who drinks water


Machine's solution(s):



http://wiki.woodpecker.org.cn/moin.cgi/PyPorgramGames_2fEinstein
这个是两种python的解法, 第二个是我写的, 用了不少python的特性.

谁用c写一个玩玩?

论坛徽章:
0
2 [报告]
发表于 2004-08-29 00:40 |只看该作者

爱因斯坦出的难题~~很老了, 谁能用c写个程序解一下?

以前就讨论过,关键是数学模型如何表示。

论坛徽章:
0
3 [报告]
发表于 2004-08-29 20:26 |只看该作者

爱因斯坦出的难题~~很老了, 谁能用c写个程序解一下?

[quote]原帖由 "kj501"]以前就讨论过,关键是数学模型如何表示。[/quote 发表:


是的,我用了解空间的概念. 运算对空间进行,而不是单个元素.


以前讨论的帖子在哪儿?
我没找到啊~~

论坛徽章:
0
4 [报告]
发表于 2004-08-30 01:09 |只看该作者

爱因斯坦出的难题~~很老了, 谁能用c写个程序解一下?

逻辑题。
我记得2003年考工硕时,有过类似的题目,好像这样的题目,在逻辑学上,有一种统一的解法(我没有记住),用图表法。

然后就能算出来。
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP