答案如下:
#include<bits/stdc++.h>
using namespace std;
int main()
{
int n;
cin>>n;
while(n--)
{
char s[100];
cin>>s;
int temp=0,an=0;
for(int i=0;i<strlen(s);i++)
{
if(s[i]=='X')
{
temp=0;
continue;
}
if(s[i]=='O')
{
temp++;
an+=temp;
}
}
cout<<an<<endl;
}
return 0;
}
本文介绍了一个使用C++编写的简单程序,该程序用于计算游戏中连续出现'O'字符所获得的分数,若出现'X'则分数清零。通过输入一系列字符,程序将输出最终得分。
447

被折叠的 条评论
为什么被折叠?



