P1042,Python,提交一直RE,本地和线上IDE却好好的,也没报错,答案(至少是样例的)也对,时间内存都没爆,下了测试点数据也正常。迷了。
lst=[]
while True:
clist=list(input())
if clist[-1]=="E":
break
lst.extend(clist)
def cal1(N):
scorelst=[]
score1=score2=0
for i in range(len(lst)):
if lst[i]=="W":
score1+=1
elif lst[i]=="L":
score2+=1
if (score1>=11 or score2>=11) and abs(score1-score2)>=2:
scorelst.append(str(score1)+":"+str(score2))
score1=score2=0
scorelst.append(str(score1)+":"+str(score2))
return scorelst
def cal2(N):
scorelst=[]
score1=score2=0
for i in range(len(lst)):
if lst[i]=="W":
score1+=1
elif lst[i]=="L":
score2+=1
if (score1>=21 or score2>=21) and abs(score1-score2)>=2:
scorelst.append(str(score1)+":"+str(score2))
score1=score2=0
scorelst.append(str(score1)+":"+str(score2))
return scorelst
for i in cal1(lst):
print(i)
print()
for i in cal2(lst):
print(i)