2703XOR

2703   XOR

题目描述

Given two integers S and F, what is the XOR (exclusive-or) of all numbers between S and F(inclusive)?

输入格式:

The first line of input is the integer T, which is the number of test cases (1 ≤ T ≤ 1000). Tlines follow, with each line containing two integers S and F (1 ≤ S  F ≤ 1 000 000 000).

输出格式:

For each test case, output the (decimal) value of the XOR of all numbers between S and F, inclusive.

输入样例 复制
5
3 10
5 5
13 42
666 1337
1234567 89101112
输出样例 复制
8
5
39
0
89998783

说明

6
16
通过提交
时空限制1000ms/128mb
题目来源
评测方式在线评测
题目类型
难        度