nbswsinwt @ 2024-08-02 15:44:30
#include<iostream>
using namespace std;
int main()
{
char str[62525];
cin >> str;
int num;
int Huawin=0, EnemWin=0;
int all=0;
for (num = 0; num < 62500&&str[num]!='E'; num++)
{
if (str[num] == 'W' || str[num] == 'L')
all++;
else
break;
}
int temp;
num = 0;
//按照11分制
while (num < all&&temp<all)
{
for (temp = num; temp - num < 11; temp++)
{
if (str[temp] == 'W')
Huawin++;
else if(str[temp]=='L')
EnemWin++;
//if(Huawin-EnemWin)
}
cout << Huawin << ":" << EnemWin<<endl;
num = temp;
Huawin = 0;
EnemWin = 0;
}
cout << endl;
//按照21分制
num = 0;
while (num < all&&temp<<all)
{
for (temp = num; temp - num < 21; temp++)
{
if (str[temp] == 'W')
Huawin++;
else if(str[temp]=='L')
EnemWin++;
}
cout << Huawin << ":" << EnemWin<<endl;
num = temp;
Huawin = 0;
EnemWin = 0;
}
}
by 小杨小小杨 @ 2024-08-02 15:46:56
@nbswsinwt 美国是什么鬼(
by __bjxx0201__ @ 2024-08-02 15:57:46
@小杨小小杨 应该是“没过”
by lihaochen123 @ 2024-08-02 16:16:14
每个输入文件包含若干行字符串,字符串有大写的
by nbswsinwt @ 2024-08-05 13:21:55
@lihaochen123 我用这个来忽略的,计算在E之前有多少个字符,然后在循环的时候用all来限制。这样可以吧?
for (num = 0; num < 62500&&str[num]!='E'; num++)
by nbswsinwt @ 2024-08-05 13:22:49
@小杨小小杨 抱歉,当时有点心急。没注意检查错别字
by lihaochen123 @ 2024-08-05 14:00:37
@nbswsinwt cin读字符串只读一行