java爱心斯坦问题,java:爱因斯坦的谜语

does anyone have o solution for einstein''s riddle?

- In a street there are five houses, painted five different colors.

- In each house lives a person of different nationality.

- These five homeowners each drink a different kind of beverage, smoke different brand of cigar and keep a different pet.

Einstein riddle is: Who owns the fish?

Necessary clues:

1. The British man lives in a red house.

2. The Swedish man keeps dogs as pets.

3. The Danish man drinks tea.

4. The Green house is next to, and on the left of the White house.

5. The owner of the Green house 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 man who smokes Dunhill.

12. The man who smokes Blue Master drinks beer.

13. The German smokes Prince.

14. The Norwegian lives next to the blue house.

15. The Blends smoker lives next to the one who drinks water.

解决方案

This definitely looks like homework to me.

Spoiler alert!!!

The German owns the fish.

That''s the solution...and technically all you asked for.

You will need a lot of permutations and combination to solve this. You can also try using brute force technique, I believe that would be simpler.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值