3 条题解

  • 0
    @ 2025-3-20 9:54:20

    本题有多个答案,python3在线测试所有答案都会不通过,因为测试答案是"无"。解题思路是暴力,因为数据不大

    ['abbbeedcbe', 'abbbeeeece', 'abcceeaece', 'abcceedcba', 'abcceeeeca', 'abddaedcba', 'cdebeeaece', 'cdebeedcba', 'cdebeeeeca']
    

    class NaXin:
        def w1(self, s):  # 传入字符串,看对应答案是否符合
            ans = -1
            for i in range(6):
                if s[i] == "b":
                    ans = i + 1
                    break
            return ans == ord(s[0]) - ord("a") + 2
    
        def w2(self, s):
            i = ord(s[1]) - ord("a") + 2
            return s[i - 1] == s[i]
    
        def w3(self, s):
            x = ""
            if s[2] == "a":
                x = s[0]
            elif s[2] == "b":
                x = s[1]
            elif s[2] == "c":
                x = s[3]
            elif s[2] == "d":
                x = s[6]
            elif s[2] == "e":
                x = s[5]
            return x == s[2]
    
        def w4(self, s):
            x = chr(s.count("a") + ord("a"))
            return x == s[3]
    
        def w5(self, s):
            i = -(ord(s[4]) - ord("a")) + 9
            return s[i] == s[4]
    
        def w6(self, s):
            if "a" <= s[5] < "e":
                return s.count("a") == s.count(chr(ord(s[5]) + 1))
            else:
                flag = True
                for i in range(1, 5):
                    if s.count("a") == s.count(chr(ord(s[5]) + i)):
                       flag = False
            return flag
    
        def w7(self, s):
            if s[6] == "a":
                return s[7] == "e"
            elif s[6] == "b":
                return s[7] == "e"
            elif s[6] == "c":
                return s[7] == "a" or s[7] == "e"
            elif s[6] == "d":
                return s[7] == "c" or s[7] == "e"
            elif s[6] == "e":
                return s[7] == "e"
        def w8(self, s):
            c = s.count("a") + s.count("e")
            return chr(c - 2 + ord("a")) == s[7]
    
        def w9(self, s):
            c = s.count("b") + s.count("c") + s.count("d")
            z = [[2, 3, 5, 7], [1, 2, 6], [1, 4, 9], [1, 8], [5, 10]]
            ans = ""
            for i, v in enumerate(z):
                if c in v:
                    ans += chr(ord("a") + i)
            return s[8] in ans
    
    if __name__ == '__main__':
        nx = NaXin()
        answer = ""
        def dg(s):
            global answer
            if len(answer) == 10:
                return
            if len(s) == 10:
                if (nx.w1(s) and nx.w2(s) and nx.w3(s) and nx.w4(s) and nx.w5(s) and nx.w6(s) and nx.w7(s) and nx.w8(s) and nx.w9(s)):
                    answer = s
                return
            for i in range(5):
                c = chr(ord("a") + i)
                dg(s + c)
    
        dg("")
        print(answer)
    
    • 0
      @ 2024-11-5 15:07:38

      cdebeedcba

      • 0
        @ 2024-4-11 12:26:04

        图像测试

        • 1

        信息

        ID
        2
        时间
        1000ms
        内存
        128MiB
        难度
        9
        标签
        (无)
        递交数
        93
        已通过
        6
        上传者