#5108. Masked Popcount
Masked Popcount
Masked Popcount
题目描述
Given integers and , compute the sum , modulo . Here, represents the bitwise operation.
What is the bitwise $\rm{AND}$ operation?
The result $x = a \mathbin{\&} b$ of the bitwise $\rm{AND}$ operation between non-negative integers $a$ and $b$ is defined as follows:is the unique non-negative integer that satisfies the following conditions for all non-negative integers :
If the place in the binary representation of and the place in the binary representation of are both , then the place in the binary representation of is . Otherwise, the place in the binary representation of is .
For example, and , so .
What is $\rm{popcount}$?
$\rm{popcount}$$(x)$ represents the number of $1$s in the binary representation of $x$.For example, $13=1101_{(2)}$, so $\rm{popcount}$$(13) = 3$.
输入格式
The input is given from Standard Input in the following format:
输出格式
Print the answer as an integer.
4 3
4
0 0
0
1152921504606846975 1152921504606846975
499791890
提示
is an integer between and , inclusive. is an integer between and , inclusive.
The sum of these values is .
It is possible that or .
Remember to compute the result modulo .
标签: AtCoder|abc356D
来源
AtCoder|abc356D