题目链接https://www.patest.cn/contest...
我的代码
#coding=utf-8
A=int(raw_input())
#前三个是甲乙两人的胜平负情况,后三个是赢得最多的BCJ,
# 注意顺序index取第一个元素
jia= [0,0,0,0,0,0]
yi = [0,0,0,0,0,0]
for _ in xrange(A):
B=raw_input()
a,b=B.split(' ')
if a=='J' :
if b=='B' :
jia[0] += 1#胜+1
yi[2] += 1
jia[5] +=1
elif b == 'C':
yi[0] += 1
jia[2] += 1
yi[4] += 1
else:
jia[1]+=1
yi[1]+=1
continue
if a=='C':
if b=='J' :
jia[0] += 1
yi[2] += 1
jia[4]+=1
elif b == 'B':
yi[0] += 1
jia[2] += 1
yi[3] += 1
else:
jia[1]+=1
yi[1]+=1
continue
else:
if b=='C':
jia[0] += 1
yi[2] += 1
jia[3]+=1
elif b == 'J':
jia[2] += 1
yi[0] += 1
yi[5] += 1
else:
jia[1]+=1
yi[1]+=1
continue
aa=jia[3:].index(max(jia[3:]))
bb=yi[3:].index(max(yi[3:]))
mylist=['B','C','J']
print jia[0],jia[1],jia[2]
print yi[0],yi[1],yi[2]
print mylist[aa],mylist[bb]