#P5772. [JSOI2016] 位运算
[JSOI2016] 位运算
Description
JYY has recently been studying bitwise operations. He found that the most interesting one is the xor operation. For the xor of two numbers, JYY discovered a fact: the xor of two numbers is if and only if they are equal. Then JYY started thinking: what properties does the xor of numbers have?
JYY wants to know: within the range from to , choose distinct integers such that the xor of these integers is . How many different ways are there to choose them? (Different selection orders are not counted multiple times; see the sample.)
JYY is a computer scientist, so the in his mind is extremely large. To describe it conveniently, if we write as a binary string, then is obtained by repeating a shorter binary string for times. For example, if and , then the binary representation of is . Since the result can be very large, you only need to output the total number of ways modulo .
Input Format
The first line contains two positive integers and .
The next line contains a string consisting of characters and .
It is guaranteed that the first character of is .
Output Format
Output one integer in one line, the number of valid selections modulo .
3 1
100
1
Hint
Sample Explanation
The only valid selection is .
Constraints
For of the testdata, , , .
Translated by ChatGPT 5
京公网安备 11011102002149号