大佬求助,跟着题解写的,只过了两个#Python
查看原帖
大佬求助,跟着题解写的,只过了两个#Python
938643
Porting楼主2024/11/29 17:42
record=input().replace('\n','')
record=record[:record.find('E')]
res=[0]*(len(record)+1)
w,l=0,0
for i in range(len(record)):
    if record[i]=='W':
        res[i]=1
    elif record[i]=='L':
        res[i]=2
for i in range(len(res)):
    if res[i]==1:
        w+=1
    if res[i]==2:
        l+=1
    if res[i]==0:
        print(f'{w}:{l}'+'\n\n',end='')
        break
    if abs(w-l)>=2:
        if w>=11 or l>=11:
            print(f'{w}:{l}'+'\n',end='')
            w=0
            l=0
w,l=0,0
for i in range(len(res)):
    if res[i]==1:
        w+=1
    if res[i]==2:
        l+=1
    if res[i]==0:
        print(f'{w}:{l}',end='')
        break
    if abs(w-l)>=2:
        if w>=21 or l>=21:
            print(f'{w}:{l}'+'\n',end='')
            w=0
            l=0
2024/11/29 17:42
加载中...