陶远航 发表于 2022-11-26 11:37:28

这个推理题目怎么用python做?

图片:https://s1.ax1x.com/2022/11/26/ztU5v9.png
请教大佬

人造人 发表于 2022-11-26 11:43:38

http删除s://fi删除shc.co删除m.cn/thr删除ead-2212删除78-1-1.ht删除ml
还不能像这样发了?
那你上面的文字是怎么发出来的?

陶远航 发表于 2022-11-26 11:43:55

<iframe src="//player.bilibili.com/player.html?aid=732823594&bvid=BV1iD4y1s7yW&cid=896295141&page=1" scrolling="no" border="0" frameborder="no" framespacing="0" allowfullscreen="true"> </iframe>

陶远航 发表于 2022-11-26 11:52:16

人造人 发表于 2022-11-26 11:43
http删除s://fi删除shc.co删除m.cn/thr删除ead-2212删除78-1-1.ht删除ml
还不能像这样发了?
那你上面的 ...

好像真不行

人造人 发表于 2022-11-26 11:54:53

你的回复触发审核了,等一等吧,一会审核通过了就发出来了

傻眼貓咪 发表于 2022-11-26 17:17:33

这题有解吗?我试了好像无解,也可能我的代码有错吧{:10_247:}{:10_247:}{:10_247:}
def Condition_1(_1, _8, _2, _4, _5):
    if _1 == _8 and _1 not in :
      return "A"
    elif _1 == _2 and _1 not in :
      return "B"
    elif _1 == _4 and _1 not in :
      return "C"
    elif _1 == _5 and _1 not in :
      return "D"
    else: return False

def Condition_2(_2, _3, _5, _6, _7, _9, _10):
    if _3 == _5 and _2 != _7 and _5 != _6 and _9 != _10:
      return "A"
    elif _2 == _7 and _3 != _5 and _5 != _6 and _9 != _10:
      return "B"
    elif _5 == _6 and _3 != _5 and _2 != _7 and _9 != _10:
      return "C"
    elif _9 == _10 and _3 != _5 and _2 != _7 and _5 != _6:
      return "D"
    else: return False

def Condition_3(_3, *arr):
    if sum() == 2:
      return "A"
    elif sum() == 5:
      return "B"
    elif sum() == 4:
      return "C"
    elif sum() == 6:
      return "D"
    else: return False

Condition_4 = lambda answer: answer
Condition_5 = Condition_1
Condition_6 = Condition_4

def Condition_7(*arr):
    arr = list(arr)
    res = 0
    for i in range(9):
      if arr == arr:
            res += 1
    D = "DBA_C"
    return D if res in else False

def Condition_8(*arr):
    if 'A' not in arr:
      return "A"
    elif 'B' not in arr:
      return "B"
    elif 'C' not in arr:
      return "C"
    elif 'D' not in arr:
      return "D"
    else: return False

def Condition_9(*arr):
    res = 0
    for answer in "ABCD":
      if list(arr).count(answer) < 4:
            res += 1
    D = "_ABCD"
    return D if res in else False

def Condition_10(_3, _4, _9, _10):
    if _3 != _4 and (_4 == _9 == _10):
      return "A"
    elif _3 != _4 and (_3 == _9 == _10):
      return "B"
    elif _9 != _4 and (_3 == _4 == _10):
      return "C"
    elif _10 != _4 and (_3 == _4 == _9):
      return "D"
    else: return False

for _1 in "ABCD":
    for _2 in "ABCD":
      for _3 in "ABCD":
            for _4 in "ABCD":
                for _5 in "ABCD":
                  for _6 in "ABCD":
                        for _7 in "ABCD":
                            for _8 in "ABCD":
                              for _9 in "ABCD":
                                    for _10 in "ABCD":
                                        if Condition_1(_1, _8, _2, _4, _5) and Condition_2(_2, _3, _5, _6, _7, _9, _10) and Condition_3(_3) and Condition_4(Condition_2(_2, _3, _5, _6, _7, _9, _10)) and Condition_5(_5, _2, _4, _1, _10) and Condition_6(_6) and Condition_7(_1, _2, _3, _4, _5, _6, _7, _8, _9, _10) and Condition_8(_2, _3, _4, _5, _6) and Condition_9(_1, _2, _3, _4, _5, _6, _7, _8, _9, _10) and Condition_10(_3, _4, _9, _10):
                                          print(Condition_1(_1, _8, _2, _4, _5), Condition_2(_2, _3, _5, _6, _7, _9, _10), Condition_3(_3), Condition_4(Condition_2(_2, _3, _5, _6, _7, _9, _10)), Condition_5(_5, _2, _4, _1, _10), Condition_6(_6), Condition_7(_1, _2, _3, _4, _5, _6, _7, _8, _9, _10), Condition_8(_2, _3, _4, _5, _6), Condition_9(_1, _2, _3, _4, _5, _6, _7, _8, _9, _10), Condition_10(_3, _4, _9, _10))

罗天才 发表于 2022-11-28 15:15:33

傻眼貓咪 发表于 2022-11-26 17:17
这题有解吗?我试了好像无解,也可能我的代码有错吧

这么长{:5_107:} 你也是辛苦了

傻眼貓咪 发表于 2022-11-28 16:27:11

罗天才 发表于 2022-11-28 15:15
这么长 你也是辛苦了

哈哈{:10_250:}

svensun 发表于 2022-12-2 13:54:11

本帖最后由 svensun 于 2022-12-2 13:57 编辑

先问一下 这题有答案吗?
我得到了个答案,貌似通?
('A', 'B', 'C', 'C', 'D', 'C', 'B', 'A', 'C', 'D')

陶远航 发表于 2022-12-3 11:29:22

svensun 发表于 2022-12-2 13:54
先问一下 这题有答案吗?
我得到了个答案,貌似通?
('A', 'B', 'C', 'C', 'D', 'C', 'B', 'A', 'C', 'D' ...

有的

陶远航 发表于 2022-12-3 11:35:13

https://s1.ax1x.com/2022/12/03/zDa8eS.png

陶远航 发表于 2022-12-3 11:36:27

傻眼貓咪 发表于 2022-11-26 17:17
这题有解吗?我试了好像无解,也可能我的代码有错吧

辛苦了

傻眼貓咪 发表于 2022-12-3 13:37:13

陶远航 发表于 2022-12-3 11:35


哈哈,可能我的代码条件函数有地方写错了,所以找不到正确解答,但大致上应该就是那样了{:10_257:}
页: [1]
查看完整版本: 这个推理题目怎么用python做?