A. Even Substrings
Posted buhuiflydepig
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了A. Even Substrings相关的知识,希望对你有一定的参考价值。
A. Even Substrings
You are given a string s=s1s2…sns=s1s2…sn of length nn, which only contains digits 11, 22, ..., 99.
A substring s[l…r]s[l…r] of ss is a string slsl+1sl+2…srslsl+1sl+2…sr. A substring s[l…r]s[l…r] of ss is called even if the number represented by it is even.
Find the number of even substrings of ss. Note, that even if some substrings are equal as strings, but have different ll and rr, they are counted as different substrings.
Input
The first line contains an integer nn (1≤n≤650001≤n≤65000) — the length of the string ss.
The second line contains a string ss of length nn. The string ss consists only of digits 11, 22, ..., 99.
Output
Print the number of even substrings of ss.
Examples
input
4 1234
output
6
input
4 2244
output
10
以上是关于A. Even Substrings的主要内容,如果未能解决你的问题,请参考以下文章
CodeForces A. Many Equal Substrings
codeforces 1029 A. Many Equal Substrings