UVa1585 Score

#include <iostream>

#include <cstdio>

#include <cstring>

using namespace std;

int main()

{

    char s[100];

    int i,j,n,ans;

    cin>>n;

    getchar();

    while (n>0)

    {

        n--;

        gets(s);

        ans=0;

        j=0;

        int len=strlen(s);

        for (i=0;i<len;i++)

        {

            if (s[i]=='O'){

                j++;

                ans+=j;        

            }

            if (s[i]=='X')

                j=0;

        }

        cout<<ans<<endl;

    }

}
View Code

 

你可能感兴趣的:(core)