【习题 3-1 UVA - 1585】Score
【链接】 我是链接,点我呀:)
【题意】
在这里输入题意
【题解】
模拟水题
【错的次数】
在这里输入错的次数
【反思】
在这里输入反思
【代码】
#include <bits/stdc++.h>
using namespace std;
string s;
int main()
{
/*freopen("F:\\rush.txt", "r", stdin);*/
int n;
scanf("%d", &n);
while (n--)
{
cin >> s;
int len = s.size();
long long ans = 0;
for (int i = 0; i < len; i++)
{
if (s[i] == 'X') continue;
int j = i;
ans++;
while (j + 1 < len && s[j + 1] == s[i])
{
j++;
ans += (j - i + 1);
}
i = j;
}
printf("%lld\n", ans);
}
return 0;
}
【习题 3-1 UVA - 1585】Score的更多相关文章
- UVa 1585 Score --- 水题
题目大意:给出一个由O和X组成的串(长度为1-80),统计得分. 每个O的分数为目前连续出现的O的个数,例如,OOXXOXXOOO的得分为1+2+0+0+1+0+0+1+2+3 解题思路:用一个变量t ...
- UVa 1585 - Score
得分是目前连续O 的个数,遇到X置0 #include <cstdio> #include <iostream> #include <cstring> using ...
- UVa 1585 - Score - ACM/ICPC Seoul 2005 解题报告 - C语言
1.题目大意 给出一个由O和X组成的字符串(长度为80以内),每个O的得分为目前连续出现的O的数量,X得分为0,统计得分. 2.思路 实在说不出了,这题没过脑AC的.直接贴代码吧.=_= 3.代码 # ...
- uva 1585 Score(Uva-1585)
vj:https://vjudge.net/problem/UVA-1585 不多说水题一个o一直加x就加的变为0 我的代码 #include <iostream> #include &l ...
- Score UVA - 1585
There is an objective test result such as "OOXXOXXOOO". An 'O' means a correct answer of ...
- 得分(Score,ACM/ICPC Seoul 2005,UVa 1585)
#include<stdio.h> int main(void) { char b; int t,cou,sum; scanf("%d",&t); getcha ...
- 得分(Score, ACM/ICPC Seoul 2005,UVa 1585)
#include<cstdio>#include<cstdlib>#include<cstring>int main(){ char s[80];//输入OOXXO ...
- UVa 1585 待解决
是在遇到第一个ooxx的时候会出错,会少算一个1 #include<stdio.h> int main() { int i,k=0,sum=0; char a[100]={"oo ...
- C++版 - UVa1585 Score - 题解
C++版 - UVa1585 Score - 题解 <算法竞赛入门经典(第二版)> 习题3-1 得分(ACM/ICPC Seoul 2005,UVa1585) 问题描述: 给出一个由O和X ...
随机推荐
- SQL查询表中的用那些索引
方法1. 使用系统表 -- 查询一个表中的索引及索引列 USE AdventureWorks2008 GO SELECT indexname = a.name , tablename = c. n ...
- js插件---画图软件wePaint如何使用(插入背景图片,保存图片,上传图片)
js插件---画图软件wePaint如何使用(插入背景图片,保存图片,上传图片) 一.总结 一句话总结:万能的wPaint方法,通过不同的参数执行不同的操作.比如清空画布参数传"clear& ...
- go channel实现
go channel实现 Go语言经过多年的发展,于最近推出了第一个稳定版本.相对于C/C++来说,Go有很多独特之出,比如提供了相当抽象的工具,如channel和goroutine.本文主要介绍ch ...
- 18/9/21模拟赛-Updated
18/9/21模拟赛 期望得分:100:实际得分:0 qwq 拿到题目第一眼,我去,这不是洛谷原题(仓鼠找Sugar)吗 又多看了几眼,嗯,对,除了是有多组数据外,就是原题 然后码码码....自以为 ...
- wpf--------------datagrid全选反选 多选进行删除操作 前后台
前台绑定 <DataGrid.Columns> <DataGridTemplateColumn > <DataGridTemplateColumn.HeaderTempl ...
- Linux 安装Nginx具体图解教程
系统:Centos6.6 64位 Nginx: http://nginx.org/en/download.html 眼下最新版本号1.9.4 我下载1.8.0 watermark/2/text/a ...
- 使用 Bluemix™ Live Sync 高速更新 Bluemix 上执行的应用程序实例
假设您要构建 Node.js 应用程序,那么能够使用 IBM® Bluemix® Live Sync 高速更新 Bluemix 上的应用程序实例,并像在桌面上进行操作一样进行开发,而无需又一次部署.执 ...
- makeMtk- user 版本编译
有时候我们需要在我们的手机上编译user 版本,先说一下user 跟eng版本的区别 user:这个版本是没有root权限的,当你adb shell进入后,linux下显示的是$,不可以push ap ...
- 8 Great Java 8 Features No One's Talking about--转载
原文地址:http://www.infoq.com/articles/Java-8-Quiet-Features If you haven’t seen some of the videos or t ...
- Codefroces 812 B. Sagheer, the Hausmeister
http://codeforces.com/problemset/problem/812/B B. Sagheer, the Hausmeister time limit per test 1 sec ...