/ OPS / 题库 /

Xor Sum

Xor Sum

#描述#
Your job is to calculate ∑(S1 XOR S2 XOR … XOR Sn) mod 1000000007, where Li <= Si <= Hi, 1 <= i <= n.
<br>
<br>
for case2: we can calculate like this: (1^2)+(1^3)+(2^2)+(2^3) = 6

#格式#
##输入格式##
The first line of the input is an integer T (T &lt= 100), which stands for the number of test cases you need to solve.

Every test case begins with an integer n (1 &lt= n &lt= 100), and followed by n pairs of integers L1, H1, L2, H2, …,Ln, Hn (1&lt=Li&lt=Hi&lt=10^9, 1&lt=i&lt=n). Every pair occupies a line.

##输出格式##
For every test case, you should output "Case #k: " first, where k indicates the case number and starts at 1. Then output the answer. See sample for more details.

#样例1#
##样例输入1##

2
1
1 10
2
1 2
2 3

##样例输出1##

Case #1: 55
Case #2: 6

#限制#
1000ms
32768KB

#提示#
xor是按位异或. 一种位运算.

#来源#

信息

ID
1852
难度
5
分类
category1 点击显示
标签
递交数
0
已通过
0
通过率
?
上传者