[Solution] Moamen and XOR solution codeforces
Moamen and Ezzat are playing a game. They create an arrayof non-negative integers where every element is less than .
Moamen wins if.
Please calculate the number of winning for Moamen arrays.
As the result may be very large, print the value modulo( ).
The first line contains a single integer( )— the number of test cases.
Each test case consists of one line containing two integersand ( , ).
For each test case, print a single value — the number of different arrays that Moamen wins with.
Print the result modulo( ).
3 3 1 2 1 4 0
5 2 1
In the first example,, . As a result, all the possible arrays are , , , , , , , and .
Moamen wins in onlyof them: , , , , and .