There is an objective test result such as “OOXXOXXOOO”. An ‘O’ means a correct answer of a problemand an ‘X’ means a wrong answer. The score of each problem of this test is calculated by itself andits just previous consecutive ‘O’s only when the answer is correct. For example, the score of the 10thproblem is 3 that is obtained by itself and its two previous consecutive ‘O’s.

  Therefore, the score of “OOXXOXXOOO” is 10 which is calculated by “1+2+0+0+1+0+0+1+2+3”.

  You are to write a program calculating the scores of test results.

Input

Your program is to read from standard input. The input consists of T test cases. The number of testcases T is given in the first line of the input. Each test case starts with a line containing a stringcomposed by ‘O’ and ‘X’ and the length of the string is more than 0 and less than 80. There is no spacesbetween ‘O’ and ‘X’.

Output

Your program is to write to standard output. Print exactly one line for each test case. The line is tocontain the score of the test case.

Sample Input

5

OOXXOXXOOO

OOXXOOXXOO

OXOXOXOXOXOXOX

OOOOOOOOOO

OOOOXOOOOXOOOOX

Sample Output

10

9

7

55

30


Regionals 2005 >> Asia - Seoul

问题链接:UVA1585 UVALive3354 Score。

问题简述:(略)

问题分析

  这个题是计算得分,得分规则有点像保龄球的得分规则,连续正确的次数越多分数越高。

程序说明

  程序逻辑都是套路。

AC的C语言程序如下:

/* UVA1585 UVALive3354 Score */#include <stdio.h>int main(void)
{int t, ans, count;char c;scanf("%d", &t);getchar();while(t--) {ans = 0;count = 0;while((c = getchar()) != '\n') {if(c == 'O') {count++;ans += count;} else if(c == 'X')count = 0;}printf("%d\n", ans);}return 0;
}

UVA1585 UVALive3354 Score【水题】相关推荐

  1. UVA1585 LA3354 Score【水题】

    There is an objective test result such as "OOXXOXXOOO". An 'O' means a correct answer of a ...

  2. hdu-5003 Osu!(水题)

    题目链接: Osu! time Limit: 2000/1000 MS (Java/Others)     Memory Limit: 65536/65536 K (Java/Others) Prob ...

  3. zcmu之水题来一波~

    1036: Shepherd 1112: 对于数字的强迫症 1137: 最后一次队内赛的a+b 1278: Sequence(哈希) 1279: Sort photos(读题) 1653: 这样真的好 ...

  4. zcmu-1653,1654...【水题集合】

    1653: 这样真的好么(*^*) Description 在某人参加的某一场比赛中,一共有k位选手参赛,他们的编号是1到k.主办方准备了n个气球,主办方同样把这n个气球随机的编号为1到k中的一个数( ...

  5. 水题/poj 1852 Ants

    1 /* 2 PROBLEM:poj1852 3 AUTHER:Nicole 4 MEMO:水题 5 */ 6 #include<cstdio> 7 using namespace std ...

  6. HDU2673-shǎ崽(水题)

    如果不能够直接秒杀的题,就不算水题.又应证了那句话,有时候,如果在水题上卡住,那么此题对于你来说,也就不算是水题了额~~ 刚睡醒,迷迷糊糊. 题目的意思很简单,求一个最大的,再求一个最小的.几乎是什么 ...

  7. 图论刷水题记录(二)(最短路-----SPFA算法)

    继第一篇的后续,又来刷水题了,写的是SPFA算法,这个算法的复杂度比较玄学,感觉能不用就不用了,但是他的好处就是可以判断负圈. 3月26日: 1.POJ 1847 Tram 题意:在一个交通网络上有N ...

  8. 图论刷水题记录(一)(最短路-----dijkstra算法)

    最近实在不知道干些什么,感觉自己除了水题什么都不会做,算了去刷一刷图论的水题吧本来想合起来一起发,想了想太长的话以后看起来也不方便,题目所以今天晚上就先发了dij部分,由上到下由易变难. 1.POJ ...

  9. hdu 2041:超级楼梯(水题,递归)

    超级楼梯Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Submissio ...

最新文章

  1. java导出为excel文件_java导出数据到excel文件
  2. linux fuser 命令 查看文件/网络端口 被什么进程占用
  3. 圆头像 微信小程序 绘图_小程序canvas绘制圆形微信头像
  4. Hyperledger Fabric 核心模块(7)Fabric-ca-client
  5. 欢乐纪中某A组赛【2019.7.9】
  6. evalin matlab,求解MATLAB问题
  7. 面试历程六:人真的有时候很奇怪
  8. sql union 和 union all
  9. 虚拟机开机时出现Press ESC in 5 seconds to skip startup.nsh, any other key to continue问题的解决办法
  10. python中pyserial模块使用方法
  11. 极验滑动验证码的识别
  12. 基于线上问答社区的逻辑性知识自动问答接口ZhidaoChatbot
  13. 海康监控如何设置STMP邮箱报警
  14. Windows安全配置技术(转)
  15. 大数据助力运营商创新转型 中国信息通信大数据大会圆满召开
  16. R语言方差分析ANOVA
  17. android achartengine 背景,Android图标库AChartEngine使用(一)曲线图
  18. .Net-C# 第一学期-第三章 上机练习+课后练习(简答题)
  19. 中职计算机应用专业课堂教学,谈谈中职计算机应用基础课程教学中翻转课堂研究...
  20. 从程序员到产品经理 第四章:敏捷开发和项目管理

热门文章

  1. 深入浅出Docker(五):基于Fig搭建开发环境
  2. mysql xp系统时间_【Mysql5.5 XP系统下载】mysql XP系统安装图解
  3. Nginx路由--Location 的使用
  4. yum提示Another app is currently holding the yum lock; waiting for it to exit...处理办法
  5. kafka 新加入副本_Apache-Kafka 核心组件和流程-控制器
  6. 计算机发展与应用说课,计算机的发展与应用说课稿.doc
  7. 剑指offer面试题41. 数据流中的中位数(二分查找)
  8. 剑指offer面试题04. 二维数组中的查找(Array)
  9. OpenCV精进之路(十一):感兴趣区域ROI和logo添加技术
  10. open cv+C++错误及经验总结(十一)