#NOMURA2020E. Binary Programming
Binary Programming
Score : points
Problem Statement
Takahashi has an empty string and a variable whose initial value is .
Also, we have a string consisting of 0 and 1.
Now, Takahashi will do the operation with the following two steps times.
- Insert a
0or a1at any position of of his choice. - Then, increment by the sum of the digits in the odd positions (first, third, fifth, ...) of . For example, if is
01101, the digits in the odd positions are0,1,1from left to right, so is incremented by .
Print the maximum possible final value of in a sequence of operations such that equals in the end.
Constraints
- consists of
0and1.
Input
Input is given from Standard Input in the following format:
Output
Print the maximum possible final value of in a sequence of operations such that equals in the end.
1101
5
Below is one sequence of operations that maximizes the final value of to .
- Insert a
1at the beginning of . becomes1, and is incremented by . - Insert a
0to the immediate right of the first character of . becomes10, and is incremented by . - Insert a
1to the immediate right of the second character of . becomes101, and is incremented by . - Insert a
1at the beginning of . becomes1101, and is incremented by .
0111101101
26