题解 | #扑克牌大小#

扑克牌大小

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


全部评论

相关推荐

05-07 17:58
门头沟学院 Java
wuwuwuoow:1.简历字体有些怪怪的,用啥写的? 2.Redis 一主二从为什么能解决双写一致性? 3.乐观锁指的是 SQL 层面的库存判断?比如 stock > 0。个人认为这种不算乐观锁,更像是乐观锁的思想,写 SQL 避免不了悲观锁的 4.奖项证书如果不是 ACM,说实话没什么必要写 5.逻辑过期时间为什么能解决缓存击穿问题?逻辑过期指的是什么 其实也没什么多大要改的。海投吧
简历中的项目经历要怎么写
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

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