uintk rand(uintk x, int A[]) {
for (int i = 0; i < n; ++i) {
if (A[i] >= 0) x ^= x << A[i];
else x ^= x >> -A[i];
}
return x;
}
Here 'The first line contains two integersand
, the size of array
and the length of type '
' respectively.
The second line containsintegers, the
-th of which is
.
Print the expected number ofmodulo
in one line.
In the first example, when, the values of function
and
are as follows:
.
.
.
.
Hence the expected value ofis
, which is congruent to
modulo
.