Description: XOR is an operator for binary numbers which applies an non-carry addition two numbers digit by digit.
For example, 1010 XOR 0110 = 1100.
Now we extend XOR into m-based numbers.
For example, for 5-based number, 40302 XOR 44312 = 34114.
That is, for two m-based digit x and y, x XOR y = (x+ y) m.
Given two m-based numbers with n digits, you can rearrange the number by swapping any two digits in this number.
After rearranging two numbers, you XOR two numbers and get a new number.
For example, You can rearrange 40302 into 20034 and rearrange 44312 into 24431, then you get 20034 XOR 24431 = 44410.
Please find the maximum possible number that can be obtained in the previous step.
To Search:
File list (Check if you may need any files):
XOR.cpp