题解 | #扑克牌大小#

扑克牌大小

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

a = input().split("-")

if len(a[0]) == len(a[1]):

if a[0][0] == "J":
    print(a[0])
elif a[0][0] == "j" and a[1][0] != "J":
    print(a[0])
elif a[0][0] == "A" and a[1][0] != "J" and a[1][0] != "j":
    print(a[0])
elif a[1][0] == "J":
    print(a[1])
elif a[1][0] == "j":
    print(a[1])
elif a[1][0] == "A":
    print(a[1])
elif int(a[0][0]) > int(a[1][0]):
    print(a[0])
elif int(a[0][0]) < int(a[1][0]):
    print(a[1])

else:

if a[0][0] == "J":
    print(a[0])
elif a[0][0] == "j" and a[1][0] != "J":
    print(a[0])
elif a[0][0] == "A" and a[1][0] != "J" and a[1][0] != "j":
    print(a[0])
elif a[1][0] == "J":
    print(a[1])
elif a[1][0] == "j":
    print(a[1])
elif a[1][0] == "A":
    print(a[1])
elif len(a[0]) == 11:
    print(a[0])
elif len(a[0]) == 7 and len(a[1]) != 11:
    print(a[0])
elif len(a[1]) == 11:
    print(a[1])
elif len(a[1]) == 7:
    print(a[1])
elif a[0][-1] == "A":
    print(a[0])
elif a[1][-1] == "A":
    print(a[1])
else:
    print("ERROR")
全部评论

相关推荐

10-31 14:54
已编辑
门头沟学院 算法工程师
点赞 评论 收藏
分享
头像
11-21 11:39
四川大学 Java
是红鸢啊:忘了还没结束,还有字节的5k 违约金
点赞 评论 收藏
分享
1 收藏 评论
分享
牛客网
牛客企业服务