dhhhhh1235 @ 2024-12-04 21:02:31
#include<iostream>
#include<cmath>
using namespace std;
int main()
{
int f[2] = { 11,21 };
int n=0;
int a[2500 * 25 + 10];
char temp;
while (1) {
cin >> temp;
if (temp == 'E') break;
else if (temp == 'W') a[n++] = 1;
else if (temp == 'L') a[n++] = 0;
}
for (int i = 0;i < 2;i++)
{
int l = 0, w = 0;
for (int j = 0;j<n;j++)
{
w += a[j], l += 1 - a[j];
if (max(w, l) >= f[i] && abs(w - l) >= 2)
{
cout << w << ": " << l<<endl;
w =l = 0;
}
}
cout << w << ": " << l << endl;
cout << endl;
}
return 0;
}
by Colas_miao_ @ 2024-12-04 21:04:46
":"用英文的啊
by iamsh @ 2024-12-04 21:06:14
":"
而不是 ": "
(不要加额外的空格)by Colas_miao_ @ 2024-12-04 21:06:18
":"后面不加空格就AC了