题解 | #扑克牌大小#

扑克牌大小

https://www.nowcoder.com/practice/d290db02bacc4c40965ac31d16b1c3eb

player1, player2 = input().split('-')
card_values = {
    '3': 3, '4': 4, '5': 5, '6': 6, '7': 7, '8': 8, '9': 9, '10': 10,
    'J': 11, 'Q': 12, 'K': 13, 'A': 14, '2': 15, 'joker':16, 'JOKER':17
}
player11, player22 = list(player1.split(' ')), list(player2.split(' '))

if len(player11) == len(player22):
    if card_values[player11[0]] < card_values[player22[0]]:
        print(player2)
    else:
        print(player1)
else:
    if "joker" in player11 or "JOKER" in player11 or "joker" in player22 or "JOKER" in player22:
        print( 'joker JOKER')
    else:
        if len(player11) == 4 or len(player22)==4 :
            if player11[0] == player11[1] == player11[2] == player11[3]:
                print(player1)
            elif player22[0] == player22[1] == player22[2] == player22[3]:
                print(player2)
        else:
            print('ERROR')

全部评论

相关推荐

11-01 08:48
门头沟学院 C++
伤心的候选人在吵架:佬你不要的,能不能拿户口本证明过户给我。。球球了
点赞 评论 收藏
分享
牛客868257804号:九个中铁八个中建
点赞 评论 收藏
分享
点赞 收藏 评论
分享
牛客网
牛客企业服务