uva 1585 Score(Uva-1585)

vj:https://vjudge.net/problem/UVA-1585

不多说水题一个o一直加x就加的变为0

我的代码

#include <iostream>
#include <cstring>
using namespace std;
main() 
{
    int a;
    cin>>a;
    for(int i=0;i<a;i++)
    {
        char str[1000];
        scanf("%s",str);
        int n=strlen(str);
        int p=0,sum=0;
        for(int j=0;j<n;j++)
        {
            if(str[j]=='X')
            p=0;
            if(str[j]=='O')
            sum+=++p;                    
        }    
        cout<<sum<<endl;
    }
}

 

posted @ 2018-10-01 23:12  baccano!  阅读(54)  评论(0编辑  收藏  举报