题解 | #扑克牌大小#

扑克牌大小

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))


全部评论

相关推荐

不愿透露姓名的神秘牛友
昨天 11:29
点赞 评论 收藏
分享
不愿透露姓名的神秘牛友
07-07 12:04
毕业生招你惹你了,问一个发薪日来一句别看网上乱七八糟的你看哪个工作没有固定发薪日扭头就取消了面试就问了一句公司都是这个态度吗还搞上人身攻击了...
程序员小白条:呃呃呃,都还没面试,我都不会问这么细,何况通不通过,去不去都另说,你没实力和学历的话,在外面就这样,说实话没直接已读不回就不错了,浪费时间基本上
点赞 评论 收藏
分享
嵐jlu:我是山川🐔里🐔🧱的,阿里系简历全过; 你这简历一看就还是半成品啊,没有荣誉经历奖项什么的吗?
投递阿里巴巴集团等公司10个岗位
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

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