- 乒乓球
- 2018-05-27 11:19:38 @
#include<iostream>
#include<cstring>
#include<string>
using namespace std;
int main()
{
string s1;
cin >> s1;
int num = s1.length();
int numhua=0;
int numming = 0;
int flaghua = 0;
int flagming = 0;
for (int i = 0; i < num; i++)
{
if (s1[i] == 'E')
{
if (numhua > 0 || numming > 0)
{
cout << numhua << ":" << numming << endl;
}
break;
}
else
{
if (s1[i] == 'W')
{
numhua++;
if (numhua >= 11 &&(numhua-numming)>=2)
{
cout <<numhua<<":" << numming << endl;
flaghua++;
numhua = 0;
numming = 0;
}
}
if (s1[i] == 'L')
{
numming++;
if (numming >= 11 && (numming-numhua )>=2)
{
cout <<numming<< ":" << numhua << endl;
flagming++;
numhua = 0;
numming = 0;
}
}
}
}
cout << endl;
numhua = 0;
numming = 0;
for (int i = 0; i < num; i++)
{
if (s1[i] == 'E')
{
if (numhua > 0 || numming > 0)
{
cout << numhua << ":" << numming << endl;
}
break;
}
else
{
if (s1[i] == 'W')
{
numhua++;
if (numhua >= 21 && (numhua - numming) >= 2)
{
cout << numhua << ":" << numming << endl;
flaghua++;
numhua = 0;
numming = 0;
}
}
if (s1[i] == 'L')
{
numming++;
if (numming >= 21 && (numming - numhua) >= 2)
{
cout << numming << ":" << numhua << endl;
flagming++;
numhua = 0;
numming = 0;
}
}
}
}
system("pause");
return 0;
}