Score uva-1585

上代码!(本人第一次写blog  0.0)

#include<stdio.h>
#include<string.h>
#include<ctype.h>
#include<math.h>
int main()
{
	char s[200];
	int n;
	scanf("%d",&n);
	while(n--){
		scanf("%s",s);
		int m=strlen(s);
		int sum=0,j=1;
		for(int i=0;i<m;i++){
			if(s[i]=='O'){
				sum+=j++;
			}
			if(s[i]=='X'){
				j=1;
			}
		}
			printf("%d\n",sum);
	}

	return 0;	
}

猜你喜欢

转载自blog.csdn.net/qq_41991981/article/details/81160391
今日推荐