#include <bits/stdc++.h>
using namespace std;
//获取对应分制的结果
void gain_grade(char grade[][25], int grades)
{
int m = 0, n = 0;
int p = 0, q = 0;
for (m = 0; m < 2501; m++)
{
for (n = 0; n < 25; n++)
{
if (grade[m][n] == 'E')
{
break;
}
else
{
if (grade[m][n] == 'W')
p++;
if (grade[m][n] == 'L')
q++;
}
if ((p >= grades || q >= grades) && (p - q >= 2 || q - p >= 2))
{
cout << p << ':' << q << endl;
q = 0;
p = 0;
}
}
if (grade[m][n] == 'E')
{
cout << p << ':' << q << endl;
break;
}
}
}
int main()
{
char grade[2501][25];
char temp;
int m = 0, n = 0;
//赋值和记录数据
for (; m < 2501; m++)
{
for (n = 0; n < 25; n++)
{
cin >> temp;
if (temp == 'E')
{
grade[m][n] = 'E';
break;
}
else
{
grade[m][n] = temp;
}
}
if (temp == 'E')
break;
}
gain_grade(grade, 11);
cout << endl;
gain_grade(grade, 21);
}
P1042 [NOIP2003 普及组] 乒乓球
最新推荐文章于 2024-09-10 15:28:21 发布
![](https://img-home.csdnimg.cn/images/20240711042549.png)