atcoder#AGC046C. [AGC046C] Shift
[AGC046C] Shift
Score : points
Problem Statement
Given is a string consisting of 0
and 1
. Find the number of strings, modulo , that can result from applying the following operation on between and times (inclusive):
- Choose a pair of integers such that the -th and -th characters of are
0
and1
, respectively. Remove the -th character from and insert it to the immediate left of the -th character.
Constraints
- consists of
0
and1
.
Input
Input is given from Standard Input in the following format:
Output
Find the number of strings, modulo , that can result from applying the operation on between and times (inclusive).
0101 1
4
Four strings, 0101
, 0110
, 1001
, and 1010
, can result.
01100110 2
14
1101010010101101110111100011011111011000111101110101010010101010101 20
113434815