UVa 1585 Score

来源:互联网 发布:olay大红瓶有用吗 知乎 编辑:程序博客网 时间:2024/06/03 18:25
#include <iostream> #include <string.h>#define maxn 100using namespace std;int main(){    int T;    cin >> T;    while(T--)    {        char s[maxn];        scanf("%s", s);        int flag = 0, total = 0;        for(int m = 0; m < strlen(s); m++)        {            if(s[m] == 'O')              flag++;            else if(s[m] == 'X')              flag = 0;            total += flag;                  }        cout << total;        putchar('\n');    }    return 0;}
原创粉丝点击