AcWing 413. 乒乓球
原题链接
简单
作者:
Value
,
2020-09-07 15:51:06
,
所有人可见
,
阅读 372
#include <iostream>
#include <cmath>
using namespace std;
string s;
void work(int score){
int my, enemy;
my = enemy = 0;
for(int i = 0; i < s.size(); i ++ ){
if(s[i] == 'W') my ++ ;
else if(s[i] == 'L') enemy ++ ;
else{
printf("%d:%d\n", my, enemy);
break;
}
if(max(my, enemy) >= score && abs(my - enemy) >= 2){
printf("%d:%d\n", my, enemy);
my = enemy = 0;
}
}
}
int main(){
string tmp;
while(cin >> tmp) s += tmp;
work(11);
cout << endl;
work(21);
return 0;
}