码迷,mamicode.com
首页 > 其他好文 > 详细

codeforces

时间:2019-04-11 01:41:39      阅读:195      评论:0      收藏:0      [点我收藏+]

标签:names   str   tin   turn   lang   using   cpp   clu   codeforce   

A.Even Substrings

#include<iostream>
#include<string.h>
using namespace std;
int main()
{
	int n;
	cin>>n;
	string str;
	cin>>str;
	long long ans=0;
	for(int i=0;i<n;i++)
	{
		if((str[i]-‘0‘)%2==0)
		ans+=(i+1);
		else continue;
	}
	cout<<ans<<endl;
	return 0;
 }

codeforces

标签:names   str   tin   turn   lang   using   cpp   clu   codeforce   

原文地址:https://www.cnblogs.com/WABoom/p/10686946.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!