您的位置:首页 > 其它

Score(模拟)uva1585

2016-06-10 19:00 309 查看
题意:用一个标识位统计出现多少个连续的o。

/* ***********************************************
Author        :Lu_cky
Created Time  :2016年06月10日 星期五 18时08分08秒
File Name     :main.cpp
************************************************ */

#include <stdio.h>
#include <string.h>
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <string>
#include <math.h>
#include <stdlib.h>
#include <time.h>
#define LL long long
using namespace std;
const int SIZE=1e3+10;
const int maxn=1<<30;
char s[110];
int main()
{
//freopen("in.txt","r",stdin);
//freopen("out.txt","w",stdout);
int T;
scanf("%d",&T);
for(int cas=1;cas<=T;cas++){
scanf("%s",s);
int f=0,ans=0;
for(int i=0;s[i]!='\0';i++){
if(s[i]=='O'){
f++;
ans+=f;
}
else f=0;
}
printf("%d\n",ans);
}
return 0;
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: