JSSL9718 @ 2024-11-25 23:30:44
#include <iostream>
#include <vector>
#include <map>
#include <cmath>
#include <sstream>
#include <algorithm>
#include <string>
using namespace std;
int main()
{
char s;
int score11_1 = 0, score11_2 = 0;
int score21_1 = 0, score21_2 = 0;
int count_11 = 0, count_21 = 0;
vector<int> a11, b11, a21, b21;
while (cin >> s)
{
if (s == 'E')
break;
if ((score11_1 >= 11 || score11_2 >= 11) && abs(score11_1-score11_2)>=2)
{
a11.push_back(score11_1);
b11.push_back(score11_2);
score11_1 = 0;
score11_2 = 0;
count_11++;
}
if ((score21_1 >= 21 || score21_2 >= 21) && abs(score21_1 - score21_2) >= 2)
{
a21.push_back(score21_1);
b21.push_back(score21_2);
score21_1 = 0;
score21_2 = 0;
count_21++;
}
if (s == 'W') score11_1++, score21_1++;
if (s == 'L') score11_2++, score21_2++;
}
for (int i = 0; i < count_11; i++)
{
cout << a11[i] << ":" << b11[i];
cout << endl;
}
if (score11_1 != 0 || score11_2 != 0)
{
cout << score11_1 << ":" << score11_2;
cout << endl;
}
cout << endl;
for (int i = 0; i < count_21; i++)
{
cout << a21[i] << ":" << b21[i];
cout << endl;
}
if (score21_1 != 0 || score21_2 != 0)
{
cout << score21_1 << ":" << score21_2;
}
return 0;
}
by lrb282818 @ 2024-12-03 18:37:41
其实特判0:0是多余的,删了就过了