AdditionPrinciple Exeter Basic
2015


Problem - 2016
Let $S$ be the string $0101010101010$. Determine the number of substrings containing an odd number of $1$'s. (A substring is defined by a pair of (not necessarily distinct) characters of the string and represents the characters between, inclusively, the two elements of the string.)

If a substring starts and ends with $1$, then whether or not appending a $0$ before or after this substring will not change the number of $1$. Hence, this problem is equivalent to finding qualified string bounded by $1$. Then the final answer is fours times of this count.

There are totally six $1$'s in this original string. As a result, there are $6$ ways to have a substring containing just one $1$, $4$ ways to have three $1$s, and $2$ ways to have five $1$s. If follows that the final answer is $$(6+4+2)\times 4=\boxed{48}$$

report an error