#K2236. Counting Zeros Game
Counting Zeros Game
Counting Zeros Game
In this problem, you are given an integer n and a binary string of length n. Your task is to compute the number of zeros (\(0\)) in the string. This count represents the number of moves/turns required to complete the game.
The game is defined as follows: for each character in the string, if it is a zero, then it contributes one turn to the total. In other words, if the binary string is \(s\), the number of turns \(T\) is given by:
[ T = \sum_{i=1}^{n} \mathbb{1}_{{s_i = 0}} ]
where \(\mathbb{1}_{\{s_i = 0\}}\) is the indicator function which is 1 if \(s_i\) is 0, and 0 otherwise.
inputFormat
The input is given via standard input (stdin). It consists of two lines:
- The first line contains an integer n, representing the length of the binary string.
- The second line contains a binary string of length n consisting only of characters '0' and '1'.
outputFormat
Output the number of zeros in the binary string. The output should be printed to standard output (stdout) as a single integer.
## sample5
10101
2