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; }
相关文章推荐
- Android多线程性能优化(二)
- Java中对多线程的认识
- 分享常见的DOM事件
- ELF文件的加载过程(load_elf_binary函数详解)--Linux进程的管理与调度(十三)
- [Mac][MySQL]如何启动MySQL Server
- nyoj 19 擅长排列的小明 【next_permutation() 】
- 单表查询查询所有字段
- MFC中屏蔽ESC和回车关闭对话框
- 限制波尔兹曼机
- 一维动态规划和二维动态规划中两道经典题目
- ContentProvider读写联系人列表以及权限处理
- Andoird Crash的跟踪方法,使用腾讯Bugly来捕捉一些疑难杂症,让我们APP稳定上线
- Andoird Crash的跟踪方法,使用腾讯Bugly来捕捉一些疑难杂症,让我们APP稳定上线
- SICP 习题2.2 线段的中点
- android 面试知识总结
- 第十六周项目一 d阅读程序(1)
- linux如何修改文件或目录的权限(chmod)
- UVa 1025 A Spy in the Metro
- Android 数据存储方式
- 修改LINUX目录或文件的权限和所有权详解