日常放水WT双奔 @ 2024-09-18 19:55:03
python代码,WA了第10个点
算法应该没问题
# 90pts
def ele():
flag = 0
cnt = w = l = 0
for ch in tot:
if ch == 'E':
break
if ch == 'W':
w += 1
cnt += 1
elif ch == 'L':
l += 1
cnt += 1
if (w >= 11 or l >= 11) and abs(w-l) >= 2 :
print(w, ":", l, sep='')
flag = 1
w = l = cnt = 0
if cnt != 0:
print(w, ":", l, sep='')
flag = 1
if flag == 0:
print("0:0")
def twn():
flag = 0
cnt = w = l = 0
for ch in tot:
if ch == 'E':
break
if ch == 'W':
w += 1
cnt += 1
elif ch == 'L':
l += 1
cnt += 1
if (w >= 21 or l >= 21) and abs(w-l) >= 2 :
print(w, ":", l, sep='')
flag = 1
w = l = cnt = 0
if cnt != 0:
print(w, ":", l, sep='')
flag = 1
if flag == 0:
print("0:0")
tot = ""
while (1):
str = input()
tot += str
f = 0
for ch in str:
if ch == 'E':
f = 1
break
if f:
break
ele()
print()
twn()
标准输入:
WWWWWWWWWWWEadfadf;jadf
标准输出:
11:0
0:0
11:0
我的输出:
11:0
11:0
by 日常放水WT双奔 @ 2024-09-18 19:57:06
解决了
# WA 50pts
def ele():
flag = 0
cnt = w = l = 0
for ch in tot:
if ch == 'E':
break
if ch == 'W':
w += 1
cnt += 1
elif ch == 'L':
l += 1
cnt += 1
if (w >= 11 or l >= 11) and abs(w-l) >= 2 :
print(w, ":", l, sep='')
flag = 1
w = l = cnt = 0
print(w, ":", l, sep='')
def twn():
flag = 0
cnt = w = l = 0
for ch in tot:
if ch == 'E':
break
if ch == 'W':
w += 1
cnt += 1
elif ch == 'L':
l += 1
cnt += 1
if (w >= 21 or l >= 21) and abs(w-l) >= 2 :
print(w, ":", l, sep='')
flag = 1
w = l = cnt = 0
print(w, ":", l, sep='')
tot = ""
while (1):
str = input()
tot += str
f = 0
for ch in str:
if ch == 'E':
f = 1
break
if f:
break
ele()
print()
twn()