您的位置:首页 > 其它

Score UVA - 1585

2017-04-03 12:46 537 查看
问题类型:字符串,计数。

03pie’s solution for [UVA-1585]:

#include<cstdio>
#include<iostream>
#include<sstream>
#include<cstdlib>
#include<cmath>
#include<cctype>
#include<string>
#include<cstring>
#include<algorithm>
#include<stack>
#include<queue>
#include<set>
#include<map>
#include<ctime>
#include<vector>
#include<fstream>
#include<list>
using namespace std;

#define ms(s) memset(s,0,sizeof(s))typedef unsigned long long ULL;
typedef long long LL;

const double PI = 3.141592653589;
const int INF = 0x3fffffff;

#define maxn 90
int main(){
//    freopen("F://inp.txt","r",stdin);

char s[maxn];
int T=0;
scanf("%d",&T);
while(T--)
{
scanf("%s",s);
int len=strlen(s);

int p=1,temp=0,score=0;
for(int i=0;i<len;i++)
{
if(s[i]=='X'){
p=0;
}
if(s[i]=='O'){
p=1;
}
if(p){
temp++;
}
else    temp=0;
score+=temp;
}
printf("%d\n",score);
}
return 0;
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: