UVa-1585 - Score
程序员文章站
2022-06-09 16:47:54
...
题解:循环统计连续的O将对应的分数加上即可。
AC代码:
#include<cstdio>
#include<cstring>
using namespace std;
const int maxn = 87;
#define _for(i,a,b) for(int i=a;i<=b;i++)
char s[maxn];
int ans,n;
int main()
{
scanf("%d",&n);
while(n--)
{
scanf("%s",s);
int leng = strlen(s);
int last = 1;
int sum = 0;
_for(i,0,leng-1)
{
if(s[i]=='O')
{
sum+=last;
last++;
}
else last = 1;
}
printf("%d\n",sum);
}
return 0;
}
上一篇: js使用定时器实现轮播图效果
下一篇: Python切片知识解析
推荐阅读
-
在pytorch 中计算精度、回归率、F1 score等指标的实例
-
Python scikit-learn (metrics): difference between r2_score and explained_variance_score?
-
在pytorch 中计算精度、回归率、F1 score等指标的实例
-
使用sklearn cross_val_score进行交叉验证
-
使用sklearn accuracy_score,f1_score,roc_auc_score,recall_score,precision_score对模型进行评估
-
模型的评价指标:Precision, Recall, F1 Score
-
elasticsearch relevance score相关性评分的计算
-
Elasticsearch 之(17)relevance score
-
我为什么没有用lucene的score来排序 lucene数据挖掘Google
-
我为什么没有用lucene的score来排序 lucene数据挖掘Google