PYTHON求助

P1042 [NOIP2003 普及组] 乒乓球

@[Ye_Cha](/user/1142704) > `print(0,':',0)` 低级错误,逗号是用空格输出,样例中没有空格。
by wangyiqing_DOCX @ 2023-12-16 10:01:36


```python m=input() while 'E' not in m: m=m+input() cut=m.index('E') m=m[:cut] hua=0 other=0 for i in range(len(m)): if m[i]=='W': hua+=1 if m[i]=='L': other+=1 if abs(hua-other)>=2 and max(hua,other)>=11:#胜利条件为分差大于二且至少有一人分数达到11分 print('{}:{}'.format(hua,other)) hua=0 other=0 print('{}:{}'.format(hua,other)) print() hua1=0 other1=0 for i in range(len(m)): if m[i]=='W': hua1+=1 if m[i]=='L': other1+=1 if abs(hua1-other1)>=2 and max(hua1,other1)>=21: print('{}:{}'.format(hua1,other1)) hua1=0 other1=0 print('{}:{}'.format(hua1,other1)) ``` 这是我的代码
by kinolo @ 2023-12-28 13:49:52


|