lissanwen 2009-11-01 21:41
浏览 273
已采纳

智商测试题

来看看这道爱因斯坦出的智商测试题, 他说世界上有98%的人回答不出, 看看你是否属于另外的2%:

[list]
[*]1. 有5栋5种颜色的房子
[*]
[*]2. 每一位房子的主人国籍都不同
[*]
[*]3. 这5个人每人只喝一个牌子的饮料, 只抽一个牌子的香烟, 只养一种宠物
[*]
[*]4. 没有人有相同的宠物, 抽相同牌子的香烟, 喝相同的饮料
[/list]

已知:

[list]
[*]1. 英国人住在红房子里
[*]
[*]2. 瑞典人养了一条狗
[*]
[*]3. 丹麦人喝茶
[*]
[*]4. 绿房子在白房子左边
[*]
[*]5. 绿房子主人喝咖啡
[*]
[*]6. 抽PALL MALL烟的人养了一只鸟
[*]
[*]7. 黄房子主人抽DUNHILL烟
[*]
[*]8. 住在中间那间房子的人喝牛奶
[*]
[*]9. 挪威人住在第一间房子
[*]
[*]10. 抽混合烟的人住在养猫人的旁边
[*]
[*]11. 养马人住在DUNHILL烟的人旁边
[*]
[*]12. 抽BLUE MASTER烟的人喝啤酒
[*]
[*]13. 德国人抽PRINCE烟
[*]
[*]14. 挪威人住在蓝房子旁边
[/list]

[b]请问 是谁养鱼?
[/b]

[b]问题补充:[/b]
[code="java"]class Person

attr_accessor :nationality, :residing, :drinking, :smoking, :pet, :number

def initialize(number, residing = nil)
@number = number
@residing = residing
end

end

class Residing

attr_accessor :number, :host, :color

def initialize(number, color = nil, host = nil)
@number = number
@host = host
@color = color
end

end

residing_1 = Residing.new(1, "yellow") # making use of condition 9, 7
person_1 = Person.new(1, residing_1)
person_1.nationality = "Norway" #making use of condition 9
person_1.smoking = "DUNHILL" #making use of condition 7
person_1.pet = "cat"
#"cat"

residing_2 = Residing.new(2, "blue") # making use of condition 14
person_2 = Person.new(2, residing_2)
person_2.pet = "horse" # condition 11
person_2.nationality = "Denmark"
person_2.drinking = "tea"
person_2.smoking = "blend cigarette"
#"Denmark" "tea" "blend"

residing_3 = Residing.new(3, nil) #making use of condition 8
person_3 = Person.new(3, residing_3)
person_3.nationality = "English"
person_3.drinking = "milk" #making use of condition 8
person_3.residing.color = "red" #making use of conditon 1
person_3.smoking = "PALL MALL"
person_3.pet = "bird"
#"PALL MALL" "bird"

residing_4 = Residing.new(4, "green")# making use
person_4 = Person.new(4, residing_4)
person_4.drinking = "coffee" # making use of condition 5
person_4.nationality = "German"
person_4.smoking = "PRINCE"
#"Germ" "PRINCE"

residing_5 = Residing.new(5, "white")# making use of condition 9,14,4
person_5 = Person.new(5, residing_5)
person_5.nationality = "Sweden"
person_5.pet = "dog"
person_5.smoking = "BLUE MASTER"
person_5.drinking = "beer"
#"Sweden" "dog"
#"BLUE MASTER" "beer"

#after the initialization of the status,input as the followings
arr = [person_1, person_2, person_3, person_4, person_5]
arr.each do |i|
i.pet ||= "fish"
puts "Nationality: #{i.nationality}; house-color: #{i.residing.color}, drink #{i.drinking},
smoke #{i.smoking}, raise the pet #{i.pet} "
end[/code]

  • 写回答

1条回答 默认 最新

  • iteye_7736 2009-11-02 17:43
    关注

    1 黄色 挪威 猫 ? DUNHILL烟
    2 蓝色 丹麦 马 茶 混合烟
    3 红色 英国 鸟 牛奶 PallMALL
    4 绿色 德国 鱼 咖啡 prince
    5 白色 瑞士 狗 啤酒 Bluemaster

    步骤:
    1.先排好房子
    英国人住在红房子里&挪威人住在蓝房子旁&挪威人住在第一间房子&绿房子在白房子左边&住在中间那间房子的人喝牛奶&绿房子主人喝咖啡 ==> 房子的顺序是 1 2 3 4 5 黄 蓝 红 绿 白
    且知道 挪威人住黄房子抽DU烟
    蓝房子的人养马
    英国人喝牛奶
    绿房子喝咖啡

    2.确认国籍
    丹麦人喝茶 => 蓝色房子或白色房子为丹麦人
    瑞士人养狗 => 绿色或者白色是瑞典人
    抽BLUE MASTER烟的人喝啤酒 => 抽blue master烟的人只可能住蓝色或者白色房子
    a.假设丹麦人住白色房子 抽blue master烟的人只可能住蓝色 而德国人抽prince 所以德国人只能住绿色房子,那么蓝色房子为瑞典人住,而蓝色房子的主人养马与瑞典人养狗不符,因此丹麦人只能住蓝色房子

    那么结果就出来了

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 像这种代码要怎么跑起来?
  • ¥15 怎么改成循环输入删除(语言-c语言)
  • ¥15 安卓C读取/dev/fastpipe屏幕像素数据
  • ¥15 pyqt5tools安装失败
  • ¥15 mmdetection
  • ¥15 nginx代理报502的错误
  • ¥100 当AWR1843发送完设置的固定帧后,如何使其再发送第一次的帧
  • ¥15 图示五个参数的模型校正是用什么方法做出来的。如何建立其他模型
  • ¥100 描述一下元器件的基本功能,pcba板的基本原理
  • ¥15 STM32无法向设备写入固件