当前位置: 代码迷 >> 综合 >> Score UVA - 1585
  详细解决方案

Score UVA - 1585

热度:63   发布时间:2023-10-13 15:03:09.0

问题类型:字符串,计数。

03pie’s solution for [UVA-1585]:

#include<cstdio>
#include<iostream>
#include<sstream>
#include<cstdlib>
#include<cmath>
#include<cctype>
#include<string>
#include<cstring>
#include<algorithm>
#include<stack>
#include<queue>
#include<set>
#include<map>
#include<ctime>
#include<vector>
#include<fstream>
#include<list>
using namespace std;#define ms(s) memset(s,0,sizeof(s))typedef unsigned long long ULL;
typedef long long LL;const double PI = 3.141592653589;
const int INF = 0x3fffffff;#define maxn 90 
int main(){
// freopen("F://inp.txt","r",stdin);char s[maxn];int T=0;scanf("%d",&T);while(T--){scanf("%s",s);int len=strlen(s);int p=1,temp=0,score=0;for(int i=0;i<len;i++){if(s[i]=='X'){p=0;}if(s[i]=='O'){p=1;}   if(p){temp++;}else    temp=0;score+=temp;}printf("%d\n",score);}return 0;
}
  相关解决方案