题解 | #扑克牌大小#

扑克牌大小

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

def dx(s):
    if s=="10":
        return ord("9")+1
    if s=="joker":
        return ord("9")+7
    if s=="JOKER":
        return ord("9")+8
    if ord("3")<=ord(s)<=ord("9"):
        return ord(s)
    if s=="J":
        return ord("9")+2
    if s=="Q":
        return ord("9")+3
    if s=="K":
        return ord("9")+4
    if s=="A":
        return ord("9")+5
    if s=="2":
        return ord("9")+6

def ptype(s):
    if s=="joker JOKER":
        return "tt"
    s=s.split()
    if len(s)==1:
        return "1"
    if len(s)==2:
        return "2"
    if len(s)==3:
        return "3"
    if len(s)==4:
        return "t"
    if len(s)==5:
        return "5"
def fun(a,b):
    if a=="joker JOKER" or b=="joker JOKER":
        return "joker JOKER"
    if ptype(a)=="t" or ptype(b)=="t":
        if ptype(a)=="t" and ptype(b)=="t":
            return a if dx(a.split()[0])>dx(b.split()[0]) else b
        return a if ptype(a)=="t" else b
    if ptype(a)==ptype(b):
        return a if dx(a.split()[0])>dx(b.split()[0]) else b
    return "ERROR"
l=input().split("-")
a,b=l[0],l[1]
print(fun(a,b))


全部评论

相关推荐

06-08 22:25
门头沟学院 Java
从零开始的转码生活:这hr不会打开手机不分青红皂白给所有人群发这句话,过一会再给所有人再发一遍,这肯定会有重复的,不管,再过一会再发一遍
点赞 评论 收藏
分享
每晚夜里独自颤抖:要求太多的没必要理
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务