Given a sequence of nnn numbers a1,a2,⋯ ,ana_1, a_2, \cdots, a_na1​,a2​,⋯,an​ and three functions.Define a function f(l,r)f(l,r)f(l,r) which returns ⊕a[x]\oplus a[x]⊕a[x] (l≤x≤rl \le x \le rl≤x≤r). The ⊕\oplus⊕ represents exclusive OR.Define a function g(l,r)g(l,r)g(l,r) which returns ⊕f(x,y)(l≤x≤y≤r)\oplus f(x,y)(l \le x \le y \le r)⊕f(x,y)(l≤x≤y≤r).Define a function w(l,r)w(l,r)w(l,r) which returns ⊕g(x,y)(l≤x≤y≤r)\oplus g(x,y)(l \le x \le y \le r)⊕g(x,y)(l≤x≤y≤r).You are also given a number of xor-queries. A xor-query is a pair (i,ji, ji,j) (1≤i≤j≤n1 \le i \le j \le n1≤i≤j≤n). For each xor-query (i,j)(i, j)(i,j), you have to answer the result of function w(l,r)w(l,r)w(l,r).InputLine 111: t(1≤t≤20)t (1 \le t \le 20)t(1≤t≤20).For each test case:Line 111: n(1≤n≤100000)n (1 \le n \le 100000)n(1≤n≤100000).Line 222: nnn numbers a1,a2,⋯ ,an(1≤ai≤109)a_1, a_2, \cdots, a_n (1 \le a_i \le 10^9)a1​,a2​,⋯,an​(1≤ai​≤109).Line 333: q(1≤q≤100000)q (1 \le q \le 100000)q(1≤q≤100000), the number of xor-queries.In the next qqq lines, each line contains 222 numbers i,ji, ji,j representing a xor-query (1≤i≤j≤n)(1 \le i \le j \le n)(1≤i≤j≤n).It is guaranteed that sum of nnn and q≤106q \le 10^6q≤106.OutputFor each xor-query (i,j)(i, j)(i,j), print the result of function w(i,j)w(i,j)w(i,j) in a single line
样例输入
5
1 2 3 4 5
5
1 3
1 5
1 4
4 5
3 5
样例输出
4
0
1
4
g(i,j):当区间长度为偶数时为零,为奇数时是区间中第1,3,5,7,9,,,,奇数位数的数的异或和
w(i,j):区间长度为len=j-i+1
若len%4=0 值为0
若len%4=1 值为区间中4k+1位数的数的异或和
若len%4=2 值为区间中4k+1和4k+2位数的数的异或和
若len%4=3 值为区间中4k+3位数的数的异或和

#include<bits/stdc++.h>
using namespace std;
const int N=1e6+20;
int a[N],b[N];
int main()
{
    int t,n,m,i,j,q,l,r,sum;
    scanf("%d",&t);
    while(t--)
    {
        scanf("%d",&n);
        memset(b,0,sizeof(b));
        for(i=1;i<=n;i++)
            scanf("%d",&a[i]);
        for(i=1;i<=n;i++)
        {
            if(i<=4)
                b[i]=a[i];
            else
                b[i]=a[i]^b[i-4];
        }
        scanf("%d",&q);
        while(q--)
        {
            scanf("%d%d",&l,&r);
            m=r-l+1;
            if(m%4==0)
            {
                cout<<"0"<<'\n';
                continue;
            }
            else if(m%4==1)
            {
                sum=b[r];
                if(l-4>=0)
                    sum^=b[l-4];
                cout<<sum<<'\n';
            }
            else if(m%4==3)
            {
                sum=b[r-1];
                if(l-3>=0)
                    sum^=b[l-3];
                cout<<sum<<'\n';
            }
            else
            {
                sum=b[r]^b[r-1];
                if(l-4>=0)
                    sum^=b[l-4];
                if(l-3>=0)
                    sum^=b[l-3];
                cout<<sum<<'\n';
            }
        }
    }
    return 0;
}