//此版本只支持一组数据输入
#include <stdio.h>
#define maxn 85
int main()
{
int scores = 0;
char c;
int serial = 0;
while (scanf_s("%c",&c))
{
if (c == 'O')
{
serial++;
scores += serial;
}
else
serial=0;
continue;
}
printf("得分为:%d", scores);
system("pause");
return 0;
}
运行结果
网友评论