【习题 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;
}
posted @ 2017-10-13 10:27  AWCXV  阅读(165)  评论(0编辑  收藏  举报