题解 | #扑克牌大小#
扑克牌大小
https://www.nowcoder.com/practice/d290db02bacc4c40965ac31d16b1c3eb
point_dic = {
'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' : 35,
'JOKER' : 40
}
while 1:
try:
cmp1, cmp2 = input().split('-')
cmp1 = cmp1.split()
cmp2 = cmp2.split()
if set(cmp1) == {'JOKER', 'joker'} or set(cmp2) == {'JOKER', 'joker'}:
print('joker', 'JOKER')
elif (len(cmp1) == 4 and len(set(cmp1)) == 1) or (len(cmp2) == 4 and len(set(cmp2)) == 1):
if (len(cmp1) == len(cmp2)) and len(set(cmp1)) == 1 and len(set(cmp2)) == 1:
if point_dic[cmp1[0]] > point_dic[cmp2[0]]: print(' '.join(cmp1))
else: print(' '.join(cmp2))
elif len(cmp1) == 4 and len(cmp2) != 4: print(' '.join(cmp1))
elif len(cmp2) == 4 and len(cmp1) != 4: print(' '.join(cmp2))
elif len(cmp1) == len(cmp2) and len(set(cmp1)) == len(set(cmp2)):
if point_dic[cmp1[0]] > point_dic[cmp2[0]]: print(' '.join(cmp1))
else: print(' '.join(cmp2))
elif len(cmp1) == len(cmp2) and len(set(cmp1)) != len(set(cmp2)):
if point_dic[cmp1[0]] > point_dic[cmp2[0]]: print(' '.join(cmp1))
else: print(' '.join(cmp2))
else:
print('ERROR')
except:
break
查看9道真题和解析