3-1 Score(P57) / UVA 1585
来源:互联网 发布:网络主播直播结束语 编辑:程序博客网 时间:2024/05/18 09:11
1.依照题意就能做,注意细节。
2.学习初期代码好长 好烦 看着好难受啊啊啊啊啊。。。。
#include <iostream>#include <cstdio>#include <cstdlib>#include <cstring>using namespace std;int main(){ int T; char s[90]; cin >> T; while(T > 0) { memset(s,0,sizeof(s)); scanf("%s",s); int num_o = 0,sum = 0,i; for(i = 0;i < strlen(s);i++) { /* 这里感觉容易错,分两种情况: 1.'O'后边是'O'; 2.'O' ①后边是'X'; ②这个'O'是最后一个。 */ if(s[i] == 'O'&&s[i+1] != 'X'&&i != strlen(s)-1) { num_o++; sum += num_o; } else if(s[i] == 'O'&&(s[i+1] == 'X'||i == strlen(s)-1)) { num_o++; sum += num_o; num_o = 0; } } printf("%d\n",sum); T--; } return 0;}
阅读全文
1 0
- 3-1 Score(P57) / UVA 1585
- UVa 1585 Score(习题3-1)
- Digit Counting (P57)/ UVA
- 小紫书 习题 3-1(UVA 1585) 得分(Score)
- 【习题3-1】 UVA - 1585 Score
- UVa 1585 Score(水)
- UVa 1585 Score(得分)
- UVA 1585 Score (数组)
- Molar mass 分子量(P57)/ UVA
- 习题3-1 得分(Score, ACM/ICPC Seoul 2005, UVa 1585)
- UVa 1585 Score(模拟 水)
- UVa 1585 Score(得分,水题)
- UVa 1585 Score 得分 (java版本)
- UVa 1585 Score
- uva 1585 - Score
- UVa 1585 - Score
- UVa 1585 - Score
- UVA 1585 - Score
- js的坑 js学习特殊语法
- 从Tomcat的架构谈Servlet职责
- 判断一个数组是否有序
- tensorflow训练cnn网络识别验证码
- nginx配置php-fpm
- 3-1 Score(P57) / UVA 1585
- jq的选择器
- CodeForces 681C Heap Operations
- myeclipse struts2环境配置(入门教程)
- 简单易用的倒计时js代码
- c语言函数定义,函数传参方法,数据结构
- oracle 11g分区表新特性---interval分区 的坑
- HDU-5943 Kingdom of Obsession(数学+二分图匹配)
- 关于集中注意力