不知哪里错了求大神指点

#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;
}

0 条评论

目前还没有评论...

信息

ID
1217
难度
7
分类
字符串 点击显示
标签
递交数
18717
已通过
4282
通过率
23%
被复制
33
上传者