有没有Py大佬帮忙看看,只有20分,我要裂开了

P1042 [NOIP2003 普及组] 乒乓球

1182hh @ 2024-09-12 17:13:33

all=""

for scr in range(25000):

aim=input()
if "E" in aim:
    for i in aim:
        if i!="E":
            all=all+i
        else:    
            break
    break
else:
    all=all+aim

def hh(n):

me=0
you=0
for sim in all:
    if sim=="W": 
        me=me+1
        if me>=n and me-you>=2:
            print(f"{me}:{you}")
            me=0
            you=0
    else:
        you=you+1
        if you>=n and you-me>=2:
            print(f"{me}:{you}")
            me=0
            you=0
if you<n and me<n:
    print(f"{me}:{you}")
elif you>n and you-me<2:
    print(f"{me}:{you}")
elif me>n and me-you<2:
    print(f"{me}:{you}")

hh(11)

print("")

hh(21)


|