主要难度在要把种种情况考虑在内,写了一大片if elif...运行时间:44ms超过43.64% 用Python 3提交的代码,占用内存:4892KB超过4.93%用Python 3提交的代码

poker = ['3', '4', '5', '6', '7', '8', '9', '10', 'J', 'Q', 'K', 'A', '2', 'joker', 'JOKER']


def is_bomb(s):
    s = s.split(" ")
    return s.count(s[0]) == 4


def is_two(s):
    s = s.split(" ")
    return s.count(s[0]) == 2


def is_three(s):
    s = s.split(" ")
    return s.count(s[0]) == 3


def is_sequence(s):
    s1 = s.split(" ")
    i = poker.index(s1[0])
    t = s1[0] + " " + poker[i + 1] + " " + poker[i + 2] + " " + poker[i + 3] + " " + poker[i + 4]
    return s == t


s = input()
s1 = s.split("-")
if s1[0] == 'joker JOKER' or s1[1] == 'joker JOKER':
    print('joker JOKER')
elif is_bomb(s1[0]) and not is_bomb(s1[1]):
    print(s1[0])
elif not is_bomb(s1[0]) and is_bomb(s1[1]):
    print(s1[1])
elif is_bomb(s1[0]) and is_bomb(s1[1]):
    a = poker.index(s1[0].split(" ")[0])
    b = poker.index(s1[1].split(" ")[0])
    if a <= b:
        print(s1[1])
    else:
        print(s1[0])
elif s1[0] in poker and s1[1] in poker:
    a = poker.index(s1[0])
    b = poker.index(s1[1])
    if a <= b:
        print(s1[1])
    else:
        print(s1[0])
elif is_two(s1[0]) and is_two(s1[1]):
    a = poker.index(s1[0].split(" ")[0])
    b = poker.index(s1[1].split(" ")[0])
    if a <= b:
        print(s1[1])
    else:
        print(s1[0])
elif is_three(s1[0]) and is_three(s1[1]):
    a = poker.index(s1[0].split(" ")[0])
    b = poker.index(s1[1].split(" ")[0])
    if a <= b:
        print(s1[1])
    else:
        print(s1[0])
elif is_sequence(s1[0]) and is_sequence(s1[1]):
    a = poker.index(s1[0].split(" ")[0])
    b = poker.index(s1[1].split(" ")[0])
    if a <= b:
        print(s1[1])
    else:
        print(s1[0])
else:
    print("ERROR")