#include<cstdio>
#include<cstdlib>
#include<cstring>
int main()
{
char s[80];//输入OOXXOXXOOO,最终得分计算为1+2+0+0+1+0+0+1+2+3=10
int m = 0, sum = 0, i = 0;
scanf("%s", s);
for (i = 0; i < strlen(s); i++)
{
if (s[i] == ‘X‘) m = 0;
if (s[i] == ‘O‘) {
m++; sum += m;
}
}
printf("%d", sum);
system("pause");
}
时间: 2024-10-08 00:08:20