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;
}
原文:https://www.cnblogs.com/WABoom/p/10686946.html