20分python求大佬指正

P1042 [NOIP2003 普及组] 乒乓球

Jarivs5272 @ 2024-08-06 08:37:27

代码如下

ss = list()
count = 0
w = 0
l = 0
re11 = list()
re21 = list()
while True:
    ss.append(input())
    count += 1
    if 'E' in ss[-1]:
        break
for v in ss:
    for i in v:
        if i == 'W':
            w += 1
        elif i == 'L':
            l += 1
        else:
            re11.append(str(w)+':'+str(l))
            break
        if abs(w - l) >= 2 and max(w, l) >= 11:
            re11.append(str(w)+':'+str(l))
            w = 0
            l = 0
w = 0
l = 0
for v in ss:
    for i in v:
        if i == 'W':
            w += 1
        elif i == 'L':
            l += 1
        else:
            re21.append(str(w)+':'+str(l))
            break
        if abs(w - l) >= 2 and max(w, l) >= 21:
            re21.append(str(w)+':'+str(l))
            w = 0
            l = 0
for j in re11:
    print(j)
print()
for k in re21:
    print(k)

上面代码我下载了数据2本地也能过啊,为啥线上就过不去,还是代码有啥错误捏,给各位大佬磕头了


|