You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

15 lines
285 B
C++

#include <bits/stdc++.h>
using namespace std;
int main() {
int n;
string s;
cin >> n >> s;
unsigned long long ans = 0;
for (int i = 0; i < n; i++)
if (((s[i] - '0') & 1) ^ 1)
ans += i + 1;
cout << ans << endl;
return 0;
}