看私信!
by jinglinbankemeng @ 2024-01-30 14:18:45
@[Jadejunxi](/user/1001542) 输入有点问题,如果最后一句没打完也要输出。看看题目。
```cpp
#include <bits/stdc++.h>
using namespace std;
int n,h = 0,d = 0,index = 0;
char c,arr[62526];
int main() {
while((scanf("%c",&c))!=EOF) {
if(c=='\n')
continue;
arr[index] = c;
index++;
}
for(int i=0; i<index; i++) {
if(arr[i]=='W') {
h++;
} else if(arr[i]=='L'){
d++;
}
if(h>=11||d>=11) {
if(abs(h-d)>=2) {
cout<<h<<':'<<d<<endl;
h = 0;
d = 0;
}
}
}
if(h||d)
cout<<h<<':'<<d<<endl,h=d=0;
cout<<endl;
for(int i=0; i<index; i++) {
if(arr[i]=='W') {
h++;
} else if(arr[i]=='L'){
d++;
}
if(h>=21||d>=21) {
if(abs(h-d)>=2) {
cout<<h<<':'<<d<<endl;
h = 0;
d = 0;
}
}
}
if(h||d)
cout<<h<<':'<<d;
return 0;
}
by Walrus @ 2024-01-30 14:20:20
@[woshifujiarui](/user/908424) thank
by Jadejunxi @ 2024-01-30 14:53:50