CF279E Beautiful Decomposition
题目描述
给定一个长度不超过 $10^6$
的二进制数 $s$,求至少要用几个 $2^k$ 和 $-2^k(k\ge0)$ 加起来值等于 $n$。
输入格式
仅一行包含字符串 $s(1\le|s|\le10^6)$。
输出格式
输出一个整数表示最少的次数
by [@_I°Fear](https://www.luogu.com.cn/user/326452)
说明/提示
In the first sample $ n=2 $ is a beautiful number.
In the second sample $ n=7 $ and Valera can decompose it into sum $ 2^{3}+(-2^{0}) $ .
In the third sample $ n=109 $ can be decomposed into the sum of four summands as follows: $ 2^{7}+(-2^{4})+(-2^{2})+2^{0} $ .