TimeLimit: 2000/1000 MS (Java/Others) MemoryLimit: 65536/65536 K (Java/Others)
64-bit integer IO format:%I64d
未提交 | 登录后收藏
Problem Description
MZL loves xor very much.Now he gets an array A.The length of A is n.He wants to know the xor of all (Ai+Aj)(1<= i,j <= n)
The xor of an array B is defined as B1 xor B2...xor Bn
Input
Multiple test cases, the first line contains an integer T(no more than 20), indicating the number of cases.
Each test case contains four integers:n,m,z,l
A1=0,Ai=(Ai−1∗m+z) mod l
1≤m,z,l≤5∗105,n=5∗105