当前你的浏览器版本过低,网站已在兼容模式下运行,兼容模式仅提供最小功能支持,网站样式可能显示不正常。
请尽快升级浏览器以体验网站在线编辑、在线运行等功能。

建议使用的浏览器:

谷歌Chrome 火狐Firefox Opera浏览器 微软Edge浏览器 QQ浏览器 360浏览器 傲游浏览器

6358:Innocence

题目描述
David is a young child. He likes playing combinatorial games, for example, the Nim game. He is just an amateur but he is sophisticated with game theory. This time he has prepared a problem for you.
Given integers $N, L, R$ and $K$, you are asked to count in how many ways one can arrange an integer array of length $N$ such that all its elements are ranged from $L$ to $R$ (inclusive) and the bitwise exclusive-OR of them equals to $K$. To avoid calculations of huge integers, print the number of ways in modulo $(10^9 + 7)$.
In addition, David would like you to answer with several integers $K$ in order to ensure your solution is completely correct.
输入解释
The first line contains one integer $T$, indicating the number of test cases.
The following lines describe all the test cases. For each test case:
The first line contains four space-separated integers $N, L, R$ and $Q$, indicating there are $Q$ queries with the same $N, L, R$ but different $K$.
The second line contains $Q$ space-separated integers, indicating several integers $K$.
$1 \leq T \leq 1000$, $1 \leq N \leq 10^9$, $0 \leq L \leq R < 2^{30}$, $1 \leq Q \leq 100$, $0 \leq K < 2^{30}$.
It is guaranteed that no more than $100$ test cases do not satisfy $1 \leq N \leq 15$, $0 \leq L, R, K < 2^{15}$.
输出解释
For each query, print the answer modulo $(10^9 + 7)$ in one line.
输入样例
3
2 3 4 2
0 7
3 3 4 2
3 4
5 5 7 4
5 6 7 8
输出样例
2
2
4
4
61
61
61
0

提示
In the first sample, there are two ways to select one number 3 and one number 4 such that the exclusive-OR of them is 7.
In the second sample, there are three ways to select one number 3 and two numbers 4 and one way to select three numbers 3 such that the exclusive-OR of them is 3.
来自杭电HDUOJ的附加信息
Recommend chendu

该题目是Virtual Judge题目,来自 杭电HDUOJ

源链接: HDU-6358

最后修改于 2020-10-25T23:30:37+00:00 由爬虫自动更新

共提交 0

通过率 --%
时间上限 内存上限
2000/1000MS(Java/Others) 262144/262144K(Java/Others)