Solution - UVa Problem 1585 - Score
আলোচনাঃ
Problem Link Here.
সল্যুশন্সঃ
#include<bits/stdc++.h>
using namespace std;
int main(){
int T;
cin >> T;
for(int i=1; i<=T; i++)
{
char w[80];
int score=0, nS=0, j;
cin >> w;
for(j=0; w[j]; j++)
{
if((w[j] == 'O'))
{
score = score +1 + nS;
nS = nS+1;
}
else if(w[j] == 'X') nS = 0;
}
cout << score << endl;
}
return 0;
}
Comments
Post a Comment