IBMOA #62
Minimum Operations to Make Alternating Binary String
估计简单可在线判题
考点(AI 标注)字符串
Each operation flips one bit; make all adjacent characters different and find the minimum number of flips. The empty string already satisfies the condition. The source statement body is missing; the operation was recovered from the title and the original example's bit-by-bit flip explanation. In the original example, flipping the 1st and 3rd bits (1-indexed) of 111101 gives 010101, so the answer is 2; the 101010 written in the original example is a typo for the target string.
输入格式
The first line contains the length n, and the second line contains the binary string (an empty line when n=0). Full original bounds: 0≤n≤200000, and the string contains only 0 and 1.
输出格式
Output one integer, the answer.
样例 1
输入:
5
11101
输出:
1
样例 2
输入:
6
111101
输出:
2
样例 3
输入:
0
输出:
0
样例说明
The outputs of the three public examples are, in order: 1; 2; 0. These answers were verified by independent enumeration or direct simulation.